Reputation: 471
Can we control the transaction retry interval in MDB? If so, please provide an example or direct me to the documentation. We want to set up a time interval of 3 min for MDB transactions. The desire is that if the query fails \first time, then it retries after 3 min of time has elapsed.
Upvotes: 3
Views: 3739
Reputation: 16056
Vairam;
Take a look at the Hornet Documentation for Message Redelivery. The issues you need to consider are:
Setting the redelivery delay
Delayed redelivery is defined in the address-setting configuration.
Example:
<!-- delay redelivery of messages for 3m -->
<address-setting match="jms.queue.exampleQueue">
<redelivery-delay>300000</redelivery-delay>
</address-setting>
Setting the maximum number of redeliveries and DLQ configuration
This can be defined declaratively by specifying the DLQ configuration in the address-setting configuration:
Example:
<!-- undelivered messages in exampleQueue will be sent to the dead letter address
deadLetterQueue after 3 unsuccessful delivery attempts
-->
<address-setting match="jms.queue.exampleQueue">
<dead-letter-address>jms.queue.deadLetterQueue</dead-letter-address>
<max-delivery-attempts>3</max-delivery-attempts>
</address-setting>
If you want to drop the message after the designated number of redelivery failures, check the message header value of "JMSXDeliveryCount" and if that number is equal to the maximum redeliveries, simply supress any exceptions and commit the transaction.
Upvotes: 3