Hi 

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"
xmlns="http://camel.apache.org/schema/spring";> 
        <route> 
          <from uri="jms:Q1" /> 
          <setHeader headerName="Test"> 
             <constant>Yes</constant> 
          </setHeader> 
          <aggregator strategyRef="aggregatorStrategy"> 
           <correlationExpression> 
             <simple>header.Test</simple> 
           </correlationExpression>                
          <to uri="jms:Q2"/> 
          </aggregator> 
        </route> 
</camelContext> 
<bean id="aggregatorStrategy"
class="com.aggregation.strategy.MessageAggregation"/> 

//JAVA Code for custom Aggregation Strategy. 
public class MessageAggregation implements AggregationStrategy{ 
        public Exchange aggregate(Exchange oldExchange, Exchange
newExchange) { 
                System.out.println("Here"); 
                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. 

Thanks 
Bala 
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Aggregation-All-Messages-Lost-from-the-Queue-tp3138936p3138936.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to