Hi, I ran into a problem with a route that called a seda endpoint. For some reason the unit of work within the seda route was completed before the actual route processing finished. Here's a simplified test case:
public class SedaUnitOfWorkTest { private String lastOne; @Test public void testSeda() throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .to("seda:foo") .delayer(2000); from("seda:foo") .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { exchange.getUnitOfWork().addSynchronization(new Synchronization() { @Override public void onComplete(Exchange exchange) { lastOne = "UnitOfWork"; } @Override public void onFailure(Exchange exchange) { lastOne = "UnitOfWork"; } }); } }) .delayer(4000) .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { lastOne = "Processor"; } }); } }); context.start(); context.createProducerTemplate().send("direct:start", new DefaultExchange(context)); Thread.sleep(7000); assertEquals("UnitOfWork", lastOne); } } I'm expecting that the unit of work is the last thing that sets the field 'lastOne'. But it isn't, the processor is called after the unit of work finished. What happens is that the exchange within the Seda route does not have its own UnitOfWork, it is using that of the other route. This might be ok if the processing of the second route would be synchronous. But as it is not, I would expect that the second route either has its own unit of work or onComplete is only called if both routes have finished processing the exchange. Or am I wrong? Thanks, Jens -- View this message in context: http://www.nabble.com/UnitOfWork-ends-too-soon-with-Seda-endpoints-tp22950359p22950359.html Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.