camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S.R." <srassok...@gmail.com>
Subject Strange behaviour of bean processor
Date Mon, 07 Jul 2008 12:18:55 GMT

I'm trying to understand how the routes work, and especially, how the bean
processors interact and make replies (for InOut pattern).

I have a following code:

// Processor  
Processor proc = new Processor() {
            public void process(Exchange exchange) throws Exception {
                // exchange.getOut().setBody(exchange.getIn().getBody() + "
Reply "); - In this case all works fine!
                exchange.getIn().setBody(exchange.getIn().getBody() + "
Reply ");
            }
        };

// Route        
from("jms:testQueue").process(proc).process(proc);

Other component sends the JMS message "abcd" to the "jms:testQueue" with
JMSReplyTo field set to "jms:replies", then listens the "jms:replies" for
response, and retrieves response like "[Processor]abcd Reply Reply " as
expected.

But when I remove the last process(proc) element like:
from("jms:testQueue").process(proc), 
and then repeat the scenario above, no replies sent on "jms:replies", and
also, no exceptions thrown telling that no response during some timeout...

Is that expected behavior and maybe I have wrong understanding? I think it
should either reply in both cases or not reply in both cases (and throw
exception about no response).

Also, it's a bit confusing when exchange.setIn(...) and exchange.setOut(..)
has the almost the same effect. As I've understood it, if we call
exchange.setOut(Out) then that Out will become the Exchange.In for the next
chain processor element, and if we don't, then we will have the same
Exchange.In in the next processor. In any case, we will have the same result
excluding the situation described above.

Thank you,
Sergey
-- 
View this message in context: http://www.nabble.com/Strange-behaviour-of-bean-processor-tp18315409s22882p18315409.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message