camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Important difference in behaviour between processRef and beanRef
Date Thu, 05 Jul 2012 09:20:10 GMT
Hi

See this FAQ
http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html


On Thu, Jul 5, 2012 at 11:06 AM, iamniche <nhemley@scottlogic.co.uk> wrote:
> Hello,
>
> I have found an important difference in behaviour between processRef and
> beanRef, which maybe someone can explain to me, please.
>
> For example, take the following route, which consumes from a queue, enriches
> the message and then finally sends the message to another queue (where
> EnricherProcessor is a Processor, implementing the 'process' method)
>
>  from(REQUEST_QUEUE_ENDPOINT)
>                 .processRef(EnricherProcessor.ENRICHERPROCESSOR_ID)
>                 .to(RESPONSE_QUEUE_ENDPOINT);
>
> When using a Processor, the original message, not the enriched one, reaches
> the response queue, which is not what is expected.
>
> Compare this to the beanRef version:
>
> from(REQUEST_QUEUE_ENDPOINT)
>                 .beanRef(EnricherProcessor.ENRICHERPROCESSOR_ID, "process")
>                 .to(RESPONSE_QUEUE_ENDPOINT);
>
> Using beanRef, the enriched messaged reaches the response queue.
>
> Why the difference in this behaviour, please?
>
> In the Processor we only ever manipulate using exchange.getIn() since then
> the 'In' is copied to the 'Out' if getOut() has not been called (as per the
> documentation)
>
> Could someone explain this difference please?
>
> Cheerio,
> Nic
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Important-difference-in-behaviour-between-processRef-and-beanRef-tp5715525.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Mime
View raw message