We have 3 different projects that are running on the same ACTIVEMQ broker. Currently there is a single "DLQ" queue, we would like to set the dlq for each web application like so:
dlq_webapp1
dlq_webapp2
dlq_webapp3
This way we will have more control on the retry flow. how can we configure it to be like so? here are some of our messaging beans:
<bean id="redeliveryConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${activemq_url}" />
<property name="redeliveryPolicy" ref="redeliveryPolicy" />
<property name="nonBlockingRedelivery" value="true" />
</bean>
<bean id="redeliveryCachingConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory"
p:targetConnectionFactory-ref="redeliveryConnectionFactory"
p:sessionCacheSize="10" />
<!-- Redelivery: retry after 3sec, 6sec,9sec,12sec,15sec finally put in
DLQ -->
<bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
<property name="queue" value="*" />
<property name="initialRedeliveryDelay" value="0" />
<property name="redeliveryDelay" value="3000" />
<property name="maximumRedeliveryDelay" value="3600000" />
<property name="maximumRedeliveries" value="5" />
<property name="useExponentialBackOff" value="true" />
<property name="backOffMultiplier" value="1" />
</bean>
<!-- A JmsTemplate instance that uses the cached connection and destination -->
<bean id="redeliveryJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="redeliveryCachingConnectionFactory" />
<property name="messageConverter" ref="eventConverter" />
<property name="sessionTransacted" value="true" />
</bean>
I think you need to configure the
deadLetterStrategy
at the broker. Please refer the examples at - ActiveMQ DLQYou can choose the
individualDeadLetterStrategy
which creates a separate DLQ for each queue (depends upon your destination policy). You can have a different prefix for each of your project/application. So that you can have only one consumer per project/application which consumes the DLQ messages from all DLQs starting with the respective prefix (use wildcards while creating consumer).You can go to your Apache ActiveMQ folder. there you will get activemq.xml in /config folder.
add this code in under the
<broker>
tag in you activemq.xml file