Hi

Your body is most likely stream based that do not support re-reading the stream.

So either enable stream-caching, or convert the message body to
something that is not a stream.
http://camel.apache.org/stream-caching.html

On Thu, Feb 9, 2012 at 4:38 PM, MichaelAtSAG <mebevilac...@gmail.com> wrote:
> I create a new class that simply prints out the contents of the message. I am
> finding the println command is changing the contents of the body.
>
> As this code demonstrates,
> <1> STEP1 prints out the body as string.
> <2> STEP2 contains no output, the body is gone.
>
> Why is the body empty in STEP2?
> Is there a better way to printout the body?
>
> public class ConsumerScreen implements Consumer {
>
>        public void process(Exchange exchange) throws Exception {
> // STEP1 - GOOD - HAS  CONTENT
>                System.out.println(lineSep + 
> exchange.getIn().getBody(String.class));
> // STEP2 - BAD - HAS NO CONTENT
>                System.out.println(lineSep + 
> exchange.getIn().getBody(String.class));
>
>        }
> }
>
> Thanks,
> Michael
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Problem-with-printing-In-message-body-tp5469798p5469798.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to