I have a small route that reads from an activemq queue and sends the message to a bean, a service client that calls a web service, and am experiencing a few issues. The onException configuration doesn't seem to get called when the bean throws an exception, and it seems like some of my concurrent consumers are getting the same message off the queue. The queue is preloaded with 500 unique messages, the messages are eventually being loaded to a database, the exception being thrown states that a duplicate key was being inserted, which could only happen if two consumers picked up the same message ( I think ). After all 500 messages are processed, I end up with ~495 in the database and 5 missing (not on the failure queue defined by the onException.
I am using ActiveMQ 5.4.1, Camel 2.8.1, Java 1.6.25, Spring 3.0.5 and Spring WS 2.0.1. Here is my configuration: *Note: I am able to catch the exception if I explicitly put a doTry and doCatch around the to endpoint in my route. Also, everything works and loads into my db fine if I use 1 or 2 consumers. <beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"xsi:schemaLocation="> <beanid="propertyConfigurer"class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><propertyname="placeholderPrefix"value="${"/><propertyname="placeholderSuffix"value="}"/> <camelContextid="camel"xmlns="http://camel.apache.org/schema/spring"> <onException> <exception>java.lang.Exception</exception> <redeliveryPolicymaximumRedeliveries="2"logStackTrace="true"logRetryAttempted="true"/> <touri="activemq:queue:loadableFailure"/> <routeid="loaderRoute"> <fromuri="activemq:queue:loadable"/> <touri="bean:loaderServiceClient?method=invokeService"/> </route> <beanid="jmsConnectionFactory"class="org.apache.activemq.ActiveMQConnectionFactory"> <propertyname="brokerURL"value="${messageQueueURI}"/> <beanid="pooledConnectionFactory"class="org.apache.activem q.pool.PooledConnectionFactory"> <propertyname="maxConnections"value="50"/> <propertyname="maximumActive"value="500"/> <propertyname="connectionFactory"ref="jmsConnectionFactory"/> <beanid="jmsConfig"class="org.apache.camel.component.jms.JmsConfiguration"> <propertyname="connectionFactory"ref="pooledConnectionFactory"/> <propertyname="concurrentConsumers"value="50"/> <beanid="activemq"class="org.apache.activemq.camel.component.ActiveMQComponent"> </beans> <propertyname="configuration"ref="jmsConfig"/></bean></bean></bean></bean><beanid="loaderServiceClient"class="com.tms.relay.ws.loader.client.LoaderServiceClient"/></camelContext> </onException><propertyname="locations"><value>classpath:environment.properties</value></property></bean>