-
1. Re: Unable to change defualt maximumRedeliveries for ActiveMQ transactions
bharadwaj Feb 2, 2015 5:21 AM (in response to gustavsinder)Use Dead letter queue - re-delivery policy
-
2. Re: Unable to change defualt maximumRedeliveries for ActiveMQ transactions
gustavsinder Feb 2, 2015 6:31 AM (in response to bharadwaj)As I understand it, a Redelivery policy is configured from the client (Camel in this case) as documented here: http://activemq.apache.org/redelivery-policy.html
However, as I interpret the documentation on camel transactions, the redelivery and backout mechanism is configured in the backing system (ActiveMQ): http://camel.apache.org/transactional-client.html
I followed the instructions here to set up my redelivery in ActiveMQ: http://activemq.apache.org/message-redelivery-and-dlq-handling.html
Unsure if I'm supposed to configure this in the ActiveMQ broker or in the client.
-
3. Re: Unable to change default maximumRedeliveries for ActiveMQ transactions
bibryam Feb 2, 2015 8:16 AM (in response to gustavsinder)I have done it by configuring on the client like this:
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="${esb.activemq.brokerURL}"/> <property name="userName" value="${esb.activemq.username}"/> <property name="password" value="${esb.activemq.password}"/> <property name="redeliveryPolicy" ref="redeliveryPolicy" /> </bean> <bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy"> <property name="maximumRedeliveries" value="${esb.activemq.maximumRedeliveries}" /> </bean>
-
4. Re: Re: Unable to change default maximumRedeliveries for ActiveMQ transactions
gustavsinder Feb 2, 2015 9:29 AM (in response to bibryam)Thanks a lot!
I got it to work by setting:
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://localhost:61616"/> <property name="userName" value="someuser"/> <property name="password" value="somepassword"/> <property name="redeliveryPolicy" ref="redeliveryPolicy"/> </bean> <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop"> <property name="maxConnections" value="8"/> <property name="connectionFactory" ref="jmsConnectionFactory"/> </bean> <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration"> <property name="connectionFactory" ref="pooledConnectionFactory"/> <property name="concurrentConsumers" value="1"/> </bean> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> <property name="configuration" ref="jmsConfig"/> <property name="transacted" value="true"/> </bean> <bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy"> <property name="maximumRedeliveries" value="0"/> </bean>
I was previously using the connection factory without pooling:
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> <property name="configuration" ref="jmsConfig"/> <property name="transacted" value="true"/> <property name="userName" value="someuser"/> <property name="password" value="somepassword"/> </bean>
It seems that I need to use a pooled connection factory to be able to use the redelivery policy.