Guys, I am having an issue with split and sending messages to the a queue. I am reading from a queue in this example and sending to another queue each of the split messages. The first message goes in the destination queue, but the I make the second message fail. I was expecting that it will cause the first message to go back to the original queue; however, since ActiveMQ is trying to redeliver 6 times, I end up with 7 in the destination queue and the original message in the DLQ. Those 7 are the first message from the split 7 times...the first one and then the 6 retries since I am using shareUnitOfWork the orignal message goes to DLQ and since it retries it 6 times, the first message ends up making it in the destination queue 1 + 6 times so I end up with 7. I get what is going on, but wondering if the first split message should not be rolled back. This example I got from the camel book and made my own modification to simulate what I am trying to accomplish. Here is the sample code. Here are the routes:
from("activemq:queue:a") .transacted() .split(body().tokenize(",")).streaming().shareUnitOfWork().stopOnException() .to("direct:quote") .to("activemq:queue:b") .end() ; from("direct:quote") .choice() .when(body().contains("Camel")) .transform(constant("Camel rocks")) .when(body().contains("Donkey")) .throwException(new IllegalArgumentException("Donkeys not allowed")) .otherwise() .transform(body().prepend("Hello ")) ; This is the test that I am using to run it...the test code is not very complete...I am not asserting anything just browsing the ActiveMQ queues after it has run. @Test public void testWithCamel() throws Exception { context.start(); template.sendBody("activemq:queue:a", "Camel,Donkey"); //Object reply = consumer.receiveBody("activemq:queue:b", 10000); Thread.sleep(60000); //assertEquals("Camel rocks", reply); } I was expecting here that Camel will be rolledback out of the queue once Donkey fails, but that does not seem to the be case even sharing the unit of work and stopping on Exception. I am wondering if this is possible to do or at the moment it hit the queue the transaction is gone...it seems to be one transaction per split message and not one transaction for the whole thing. Please let me know how I can accomplish this. I am using Camel 2.11.0 and ActiveMQ 5.8.0 Thank you!! -- View this message in context: http://camel.465427.n5.nabble.com/Issue-with-Transactions-and-Split-tp5738618.html Sent from the Camel - Users mailing list archive at Nabble.com.