camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bxkrish <>
Subject Camel Aggregation : All Messages Lost from the Queue.
Date Mon, 04 Oct 2010 00:33:02 GMT


I am using Camel 2.0. I am trying to do a simple aggregation of messages
dropped in one Queue to another Queue. 

For Example: Q1 = 1,2,3,4...10 messages, I want it to be 1 message in Q2
which is concatenation of (1,2,3, 4...10). 

I do not have any specific Correlation Expression, hence just creating a
Constant Header. 

Below is my configuration from Camel Context. 

<camelContext trace="false" id="EIP_CamelConext"
          <from uri="jms:Q1" /> 
          <setHeader headerName="Test"> 
          <aggregator strategyRef="aggregatorStrategy"> 
          <to uri="jms:Q2"/> 
<bean id="aggregatorStrategy"

//JAVA Code for custom Aggregation Strategy. 
public class MessageAggregation implements AggregationStrategy{ 
        public Exchange aggregate(Exchange oldExchange, Exchange
newExchange) { 
                Message newIn = newExchange.getIn(); 
                String oldBody = oldExchange.getIn().getBody(String.class); 
                String newBody = newIn.getBody(String.class); 
                newIn.setBody(oldBody + newBody); 
                return newExchange; 

At runtime the messages are getting cleared from Q1 and nothing is available
on Q2. I can see the MessageAggregation is getting called. 

Please help. 

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message