On Mon, Oct 4, 2010 at 2:33 AM, bxkrish <balainf...@gmail.com> wrote:
>
> 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.
>

Is there a reason why you use the old Camel 2.0 release? If possible
upgrade to the latest stable release which is 2.4.

Anyway make sure that you don't throw an exceptions from your custom
MessageAggregation code.
That could potential cause the aggregated message not to complete and send to Q2



> 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.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to