You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Andrea 123 <an...@gmail.com> on 2008/02/20 21:54:36 UTC

aggregator and JMS: AggregatorStrategy does not get called

Hi I'm new to camel (currently using 1.3-SNAPSHOT). I don't understand how to
aggregate messages from a JMS endpoint and sent the result to a bean. I've
tried the following configuration:

//private static final String ENDPOINT = "jms:myqueue";
private static final String ENDPOINT = "direct:myqueue";

from(ENDPOINT).aggregator(header("JMSCorrelationId"),new
MyAggregatorStrategy()).bean(new SomeBean());

With ENDPOINT = "jms:myqueue" I get:

[                      Thread-1] MyRouteBuilder                 INFO 
Sending: message:1
[                      Thread-1] MyRouteBuilder                 INFO 
Sending: message:2
[                      Thread-1] MyRouteBuilder                 INFO 
Sending: message:3
[meBean@3c2797]] Polling Thread] MyRouteBuilder                 INFO 
Received: message:2 (null)

End with ENDPOINT = "direct:myqueue" I get:

[                      Thread-1] MyRouteBuilder                 INFO 
Sending: message:1
[                      Thread-1] MyRouteBuilder                 INFO 
Sending: message:2
[                      Thread-1] MyRouteBuilder                 INFO 
Sending: message:3
[meBean@3c2797]] Polling Thread] MyAggregatorStrategy           INFO 
Strategy: message:1, message:2
[meBean@3c2797]] Polling Thread] MyAggregatorStrategy           INFO 
Strategy: message:1, message:2, message:3
[meBean@3c2797]] Polling Thread] MyRouteBuilder                 INFO 
Received: message:1, message:2, message:3 (null)

Only with ENDPOINT = "direct:myqueue" I get the expected behavior.

I've noticed the AggregatorStrategy even does not get called while using the
JMS endpoit.

I upload the complete sample (sample.zip)

There is also a second issue I can not explain: on the sample I've tried to
use a JMSCorrelationId but printing @Header(name="JMSCorrelationID") String
correlationID I get "null".

PS: Same sample using 1.2.0, the AggregatorStrategy get called but I loose
message 2
[                      Thread-1] MyRouteBuilder                 INFO 
Sending: message:1
[                      Thread-1] MyRouteBuilder                 INFO 
Sending: message:2
[                      Thread-1] MyRouteBuilder                 INFO 
Sending: message:3
[meBean@2cfeb7]] Polling Thread] MyAggregatorStrategy           INFO 
Strategy: message:1, message:3
[meBean@2cfeb7]] Polling Thread] MyRouteBuilder                 INFO 
Received: message:1, message:3 (null)

Thanks
Andrea
http://www.nabble.com/file/p15598169/sample.zip sample.zip 




-- 
View this message in context: http://www.nabble.com/aggregator-and-JMS%3A-AggregatorStrategy-does-not-get-called-tp15598169s22882p15598169.html
Sent from the Camel - Users mailing list archive at Nabble.com.