org.apache.camel.processor.aggregate.UseLatestAggregationStrategy Java Examples

The following examples show how to use org.apache.camel.processor.aggregate.UseLatestAggregationStrategy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CamelMailetProcessor.java    From james-project with Apache License 2.0 6 votes vote down vote up
@Override
public void configure() {
    String state = container.getState();
    CamelProcessor terminatingMailetProcessor = new CamelProcessor(metricFactory, container, new TerminatingMailet());

    RouteDefinition processorDef = from(container.getEndpoint())
        .routeId(state)
        .setExchangePattern(ExchangePattern.InOnly);

    for (MatcherMailetPair pair : pairs) {
        CamelProcessor mailetProccessor = new CamelProcessor(metricFactory, container, pair.getMailet());
        MatcherSplitter matcherSplitter = new MatcherSplitter(metricFactory, container, pair);

        processorDef
                // do splitting of the mail based on the stored matcher
                .split().method(matcherSplitter)
                    .aggregationStrategy(new UseLatestAggregationStrategy())
                .process(exchange -> handleMailet(exchange, container, mailetProccessor));
    }

    processorDef
        .process(exchange -> terminateSmoothly(exchange, container, terminatingMailetProcessor));

}