I already asked this question on Camel mailing list. This seems to be a problem introduced in ActiveMQ 5.3.0. Reproducible both with Camel 2.0.0 and 2.1.0.
Here is the unit test: ================================== @ContextConfiguration public class PollingConsumerTest extends AbstractTestNGSpringContextTests { @EndpointInject(uri = "mock:end") protected MockEndpoint endpoint; @Produce(uri = "activemq:start") protected ProducerTemplate start; @Produce(uri = "activemq:inQueue") protected ProducerTemplate inQueue; @Test @DirtiesContext public void test() throws InterruptedException { endpoint.setResultWaitTime(10000l); endpoint.expectedMessageCount(1); endpoint.message(0).body().isEqualTo("foo/bar/"); inQueue.sendBody("foo"); inQueue.sendBody("bar"); start.sendBody("start"); endpoint.assertIsSatisfied(); } public static class Consumer { private ConsumerTemplate consumerTemplate; @EndpointInject(uri = "activemq:inQueue") protected Endpoint endpoint; @Required public void setConsumerTemplate(ConsumerTemplate consumerTemplate) { this.consumerTemplate = consumerTemplate; } @Handler public String process() { Exchange exchange; StringBuilder result = new StringBuilder(); while ((exchange = consumerTemplate.receive(endpoint, 2000l)) != null) { result.append(exchange.getIn().getBody(String.class)).append('/'); } return result.toString(); } } public static class TestRoutes extends SpringRouteBuilder { @Override public void configure() throws Exception { from("activemq:start") .to("bean:consumer") .to("mock:end"); } } } And corresponding context.xml: ================================== <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/> </bean> <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager"> <property name="connectionFactory" ref="jmsConnectionFactory"/> </bean> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> <property name="connectionFactory" ref="jmsConnectionFactory"/> <property name="transacted" value="true"/> <property name="transactionManager" ref="jmsTransactionManager"/> </bean> <bean id="consumer" class="org.apache.camel.PollingConsumerTest $Consumer"> <property name="consumerTemplate" ref="consumerTemplate"/> </bean> <bean id="routeBuilder" class="org.apache.camel.PollingConsumerTest $TestRoutes"/> <camelContext xmlns="http://camel.apache.org/schema/spring"> <consumerTemplate id="consumerTemplate"/> <routeBuilder ref="routeBuilder"/> </camelContext> </beans> This test fails for activemq-camel 5.3.0 but succeeds for activemq-camel 5.2.0 Interesting thing is that test will succeed with activemq-camel 5.3.0 if I take the transactional setup from context.xml (none of the routes are marked as transacted). In other words, test will succeed if I just have this for activemq in context file: <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> <property name="brokerURL" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/> </bean> Cheers, -- Dragisa Krsmanovic Java Developer Public Library of Science http://www.plos.org -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- This email is confidential to the intended recipient. If you have received it in error, please notify the sender and delete it from your system. Any unauthorized use, disclosure or copying is not permitted. The views or opinions presented are solely those of the sender and do not necessarily represent those of Public Library of Science unless otherwise specifically stated. Please note that neither Public Library of Science nor any of its agents accept any responsibility for any viruses that may be contained in this e-mail or its attachments and it is your responsibility to scan the e-mail and attachments (if any).