use of org.apache.camel.support.SynchronizationAdapter in project camel by apache.
the class SedaInOutChainedWithOnCompletionTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("seda:a").process(new Processor() {
public void process(Exchange exchange) throws Exception {
// should come in last
exchange.addOnCompletion(new SynchronizationAdapter() {
@Override
public void onDone(Exchange exchange) {
template.sendBody("mock:c", "onCustomCompletion");
}
});
}
}).to("mock:a").transform(simple("${body}-a")).to("seda:b");
from("seda:b").to("mock:b").transform(simple("${body}-b")).to("seda:c");
from("seda:c").to("mock:c").transform(simple("${body}-c"));
}
};
}
use of org.apache.camel.support.SynchronizationAdapter in project camel by apache.
the class SedaWaitForTaskCompleteOnCompletionTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
errorHandler(defaultErrorHandler().maximumRedeliveries(3).redeliveryDelay(0));
from("direct:start").process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.addOnCompletion(new SynchronizationAdapter() {
@Override
public void onDone(Exchange exchange) {
done = done + "A";
}
});
}
}).to("seda:foo?waitForTaskToComplete=Always").process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
done = done + "B";
}
}).to("mock:result");
from("seda:foo").errorHandler(noErrorHandler()).process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
done = done + "C";
}
}).throwException(new IllegalArgumentException("Forced"));
}
};
}
Aggregations