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
[EMAIL PROTECTED] 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
[EMAIL PROTECTED] Polling Thread] MyAggregatorStrategy           INFO 
Strategy: message:1, message:2
[EMAIL PROTECTED] Polling Thread] MyAggregatorStrategy           INFO 
Strategy: message:1, message:2, message:3
[EMAIL PROTECTED] 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
[EMAIL PROTECTED] Polling Thread] MyAggregatorStrategy           INFO 
Strategy: message:1, message:3
[EMAIL PROTECTED] 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.

Reply via email to