camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Aggregator2: completion size using expression doesn't work?
Date Thu, 08 Apr 2010 07:44:23 GMT
Hi

Okay I have had a look. You need to enable eagerCheckCompletion() to
test for the header in the INCOMING message.
Then it should work. Otherwise it will check for the header in the
AGGREGATED exchange and since its being _grouped_ that means it cannot
find the header.



On Wed, Apr 7, 2010 at 12:47 PM, eugene hardbread <elukyanchuk@gmail.com> wrote:
> Hello
>
> I am trying to configure aggregator2 using completionSize with header
> expression:
>
> public class AggregatorTest extends CamelTestSupport{
>    @EndpointInject(uri = "mock:result")
>    private MockEndpoint mockResult;
>
>    @Override
>    protected RouteBuilder createRouteBuilder() throws Exception {
>        return new RouteBuilder() {
>            @Override
>            public void configure() throws Exception {
>                from("direct:aggregatorTest")
>
> .aggregate(header("group_id")).groupExchanges().completionSize(header("quantity_in_group"))
>                     .to("mock:result");
>
>            }
>        };
>    }
>
>    @Produce
>    private ProducerTemplate template;
>
>    @Test
>    public void testAggregator() throws InterruptedException {
>        Map<String, Object> headers = new HashMap<String, Object>();
>        headers.put("group_id", 1);
>        headers.put("quantity_in_group", 2);
>
>        mockResult.setExpectedMessageCount(1);
>
>        template.sendBodyAndHeaders("direct:aggregatorTest", "message
> one", headers);
>        template.sendBodyAndHeaders("direct:aggregatorTest", "message
> two", headers);
>
>        mockResult.assertIsSatisfied();
>
>        Exchange result = mockResult.getExchanges().get(0);
>
>        List<Exchange> group = (List<Exchange>)
> result.getProperty(Exchange.GROUPED_EXCHANGE);
>
>        assertListSize(group, 2);
>
>    }
>
> }
>
> Nothing is sent to mockResult.
>
> Am I doing something wrong or is it an aggregator2 issue? With
> completionTimeout everything works fine. Version of Camel: current
> 2.3-SNAPSHOT from the Apache snapshot repo.
>
> Thanks,
> Eugene
>



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

Mime
View raw message