camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Exception not getting caught and multiple consumers getting the same message
Date Sun, 02 Oct 2011 07:08:26 GMT

Can you post the XML so its readable :)

On Sat, Oct 1, 2011 at 6:40 PM, Aaron Doyle <> wrote:
> 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=""xmlns:xsi=""
>"xsi:schemaLocation="> <beanid="propertyConfigurer"class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><propertyname="placeholderPrefix"value="${"/><propertyname="placeholderSuffix"value="}"/> <camelContextid="camel"xmlns="">    <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=""/></camelContext>    </onException><propertyname="locations"><value></value></property></bean>

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message