Configuring redelivery delay and maximumRedeliveries when working with AMQ
maciavelli Oct 29, 2015 12:54 AMHello. My environments:
WildFly 8.1. SwitchYard 2.0. Active MQ 5.11.
I made an SY application which gets messages from queue in ActiveMq message broker. For this task I have added resource adapter in WildFly:
<subsystem xmlns="urn:jboss:domain:resource-adapters:2.0"> <resource-adapters> <resource-adapter id="activemq-rar.rar"> <module slot="main" id="org.apache.activemq"/> <transaction-support>XATransaction</transaction-support> <config-property name="ServerUrl"> failover:(tcp://sdbo-db:61616) </config-property> <connection-definitions> <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/AMQConnectionFactory" enabled="true" use-java-context="true" pool-name="AMQConnectionFactory"> <xa-pool> <min-pool-size>1</min-pool-size> <max-pool-size>20</max-pool-size> <prefill>false</prefill> <is-same-rm-override>false</is-same-rm-override> </xa-pool> </connection-definition> </connection-definitions> <admin-objects> <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="queue/dwh_egov_gueue" use-java-context="true" pool-name="target_queue"> <config-property name="PhysicalName"> dwh_egov_gueue </config-property> </admin-object> </admin-objects> </resource-adapter> </resource-adapters> </subsystem>
In SY I made service with JMS binding:
As shown above I am not configuring JMS bridge, just directly use queue from SY application.
The whole diagram looks like:
With that setting I could get messages in my Camel Route.
And now the problem. When I get Exception during processing message, the message from the queue 7 times redelivers with fractions of seconds interval and after that message get to DLQ in AMQ.
But I want to set redeliver count to 10 with 2 mintues interval and only after that put message to DLQ. How it can be done?
I tried to setting up redeliver options in AMQ:
..................... <plugins> <redeliveryPlugin fallbackToDeadLetter="true" sendToDlqIfMaxRetriesExceeded="true"> <redeliveryPolicyMap> <redeliveryPolicyMap> <redeliveryPolicyEntries/> <defaultEntry> <redeliveryPolicy maximumRedeliveries=10" initialRedeliveryDelay="5000" redeliveryDelay="120000"/> </defaultEntry </redeliveryPolicyMap> </redeliveryPolicyMap> </redeliveryPlugin> </plugins> </broker>
But it is not helped. I couldn't found any options in WildFly which would affect on queue redelivery in resource-adapters subsystem.