camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laci Gaspar <laci...@gmail.com>
Subject request reply
Date Thu, 04 Feb 2016 08:57:26 GMT
Hi
I was playing around with request / reply a  bit and found something I 
can't understand.
When I run the followin snippet:

     @Produce(uri = "direct:start")
     protected ProducerTemplate start;
     @EndpointInject(uri = "mock:end")
     protected MockEndpoint mockEnd;

     @Test
     public void test002() throws InterruptedException {

         mockEnd.expectedMessageCount(1);
         String message = "my message";
         logger.info("Sending Message:" + message);
         start.requestBody(message);
         assertMockEndpointsSatisfied();
     }

My routes are the following:

from("direct:start").log("starting....").to("JMSConnectionFactory:queue:replier?replyTo=replyToQueue")
                         .log("back from 
replier").log("Body:${body}").to("mock:end");
from("JMSConnectionFactory:queue:replier").log("in replier...");
from("JMSConnectionFactory:queue:replyToQueue").log("we are in 
replyToQueue");


Then I get the following result:
[                          main] route1 INFO  starting....
[                          main] QueueReplyManager              WARN 
Endpoint[JMSConnectionFactory://queue:replier?replyTo=replyToQueue] is 
using a shared reply queue, which is not as fast as alternatives. See 
more detail at the section 'Request-reply over JMS' at 
http://camel.apache.org/jms
[read #0 - JmsConsumer[replier]] TransportConnector             INFO  
Connector vm://localhost started
[read #0 - JmsConsumer[replier]] route2                         INFO  in 
replier...
[#1 - JmsConsumer[replyToQueue]] route3                         INFO  we 
are in replyToQueue
[#1 - JmsConsumer[replyToQueue]] route3                         INFO  we 
are in replyToQueue
[#1 - JmsConsumer[replyToQueue]] route3                         INFO  we 
are in replyToQueue
[#1 - JmsConsumer[replyToQueue]] route3                         INFO  we 
are in replyToQueue
[#1 - JmsConsumer[replyToQueue]] route3                         INFO  we 
are in replyToQueue
[#1 - JmsConsumer[replyToQueue]] route3                         INFO  we 
are in replyToQueue
[ueueReplyManager[replyToQueue]] route1                         INFO  
back from replier
[ueueReplyManager[replyToQueue]] route1                         INFO  
Body:my message
[                          main] MockEndpoint                   INFO  
Asserting: Endpoint[mock://end] is satisfied

What I don't understand are the lines: "we are in replyToQueue". Why is 
the route run several times (the number differs from test to test)?

Thanks,
Laci



Mime
View raw message