camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Payload Gets Nulled Out
Date Sat, 18 Apr 2009 04:33:12 GMT
Hi,

Please keep in mind, if you are using pipeline message pattern,
the pipeline processor will copy the in message to the in message of
the next processor's exchange if there is no out message. But if you set the
out
message to the exchange, the pipeline processor will copy the out message
into the in message of next processor's exchange.
You may need to change the processor() like this
...
process(new Processor() {
     public void process(Exchange exchange) throws Exception {
          ...
          exchange.getOut().setHeader("foo", "bar")
          exchange.getOut().setBody(exchange.getIn().getBody);
         ...
     }
}).to("seda:next");


Willem

On Sat, Apr 18, 2009 at 4:35 AM, Joe Fernandez <
joe.fernandez@ttmsolutions.com> wrote:

>
> Hello Camel Riders,
>
> I implemented a simple pipeline message pattern and ran across a situation
> where I would lose the body of my inbound message as it got forwarded from
> one processor to the next. In other words, the exchange.getIn().getBody()
> method would return null. I finally narrowed it down to the
> exchange.getOut().setHeader() method, which I have listed below. If I
> comment out that line, the next processor can get the inbound body. Why
> would setting a header in the outbound message affect the inbound message?
> Am I doing something wrong?
>
> ...
> process(new Processor() {
>      public void process(Exchange exchange) throws Exception {
>           ...
>           exchange.getOut().setHeader("foo", "bar");
>           ...
>      }
>   }).to("seda:next");
>
> Thanks,
> Joe
>
> --
> View this message in context:
> http://www.nabble.com/Payload-Gets-Nulled-Out-tp23105477p23105477.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message