use of org.apache.camel.processor.BodyInAggregatingStrategy in project camel by apache.
the class AggregateUnknownExecutorServiceRefTest method testAggregateUnknownExecutorServiceRef.
public void testAggregateUnknownExecutorServiceRef() throws Exception {
try {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").aggregate(header("id"), new BodyInAggregatingStrategy()).completionSize(3).executorServiceRef("myUnknownProfile").to("log:foo").to("mock:aggregated");
}
});
context.start();
fail("Should have thrown exception");
} catch (FailedToCreateRouteException e) {
IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertTrue(cause.getMessage().contains("myUnknownProfile"));
}
}
use of org.apache.camel.processor.BodyInAggregatingStrategy in project camel by apache.
the class DistributedOptimisticLockFailingTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:fails").aggregate(header("id"), new BodyInAggregatingStrategy()).aggregationRepository(new AlwaysFailingRepository()).optimisticLocking().optimisticLockRetryPolicy(new OptimisticLockRetryPolicy().maximumRetries(5)).completionSize(2).to("mock:result");
from("direct:everysecondone").aggregate(header("id"), new BodyInAggregatingStrategy()).aggregationRepository(sharedRepository).optimisticLocking().completionSize(8).to("mock:result");
}
};
}
use of org.apache.camel.processor.BodyInAggregatingStrategy in project camel by apache.
the class AggregateEagerCheckCompletionTest method testAggregateNotEagerCheckCompletion.
public void testAggregateNotEagerCheckCompletion() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").aggregate(header("id"), new BodyInAggregatingStrategy()).completionPredicate(body().isEqualTo("A+B+END")).to("mock:result");
}
});
context.start();
getMockEndpoint("mock:result").expectedBodiesReceived("A+B+END");
template.sendBodyAndHeader("direct:start", "A", "id", 1);
template.sendBodyAndHeader("direct:start", "B", "id", 1);
template.sendBodyAndHeader("direct:start", "END", "id", 1);
assertMockEndpointsSatisfied();
}
Aggregations