Вопрос

I have a problem with the activemq *aggregator*, would be very thankfull if someone would help me out somehow. Marshaling into a xml.

So i have my route configured like this:

<route id="myRoute">
        <from uri="timer:someScheduler?period=5000" />
        <bean ref="someBean" method="someMethod" />
        <marshal>
            <jaxb contextPath="some package" />
        </marshal>
        <split streaming="true">
            <tokenize token="@id" group="1000" />
            <to uri="activemq:topic:some_topic" />
        </split>
        </route>

This works and it splits my xml messages composed by 1k rows, tho dunno how to configure the aggregator in order to put together all the messages before proceding with their processing.

This is it(doesn't work):

<route id="myRoute">
        <from uri="activemq:topic:some_Topic" />
        <aggregate completionSize="5"> 
            <correlationExpression>
            <constant>true</constant>
            </correlationExpression>
             <to uri="mock:aggregated"/>
        </aggregate>
        <unmarshal>
            <jaxb contextPath="some_package" />
        </unmarshal>
        <bean ref="someBean" method="someMethod" /> 
    </route>

Thanks in advance!

Это было полезно?

Решение

What you need to do is to provide the aggregator with an implementation of an AggregationStrategy - this is a class that tells the pattern how to assemble two objects that match the correllationExpression. See Camel Aggregator for an example as to how to do this.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top