Robert Thullner wrote:
> 
> Hello
>  
> I want to aggregate severals JMS Messages according to their
> JMSCorrelationId. It is not fixed how many messages these are, it can be
> only 2 but also about 10 messages. What I found out until now, is that I
> need an AggregationStrategy to achieve this. However I did not find a
> solution for my AggregationStrategy, so that it works as I like. 
>  
> Can you give me hints how to write my AggregationStrategy, so that I can
> aggregate all JMS message with the same JMSCorrelationID?
>  
> Thanks
> Robert
> 
> 

Hi,

Probably what you need is not an AggregationStrategy, but specific
Expression implementor that make Aggregator corelate messages with the same
JMSCorrelationID. Try use something like that:

Expression aggregatorExpression = new Expression(){
                    public Object evaluate(Exchange exchange) {
                        JmsMessage in = (JmsMessage) exchange.getIn();
                        String jmsCorrelationID = null;
                        try {
                            jmsCorrelationID =
in.getJmsMessage().getJMSCorrelationID();
                        } catch (JMSException e) {
                            throw new RuntimeException(e);
                        }
                        return jmsCorrelationID;
                    }
                }; 

Such class should be passed to aggregate(...)

Przemek
-- 
View this message in context: 
http://www.nabble.com/Aggregation-problems-tp14774855s22882p14774997.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to