Hi

Or just set the header on the IN body.

So the rule of thumb with the pipeline is basically as Willem writes.
If OUT != null then use OUT otherwise use IN.

So if you just need to alter/set a single header on the payload then
you can just do it on IN and it will keep all the other data.
If you set something on OUT then you are starting from scratch and
must copy/set all the values you want to keep.


On Sat, Apr 18, 2009 at 6:33 AM, Willem Jiang <[email protected]> wrote:
> 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 <
> [email protected]> 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.
>>
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration

Reply via email to