开发者

MDB transaction retry interval

开发者 https://www.devze.com 2023-04-02 19:03 出处:网络
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 transactio

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.


Vairam;

Take a look at the Hornet Documentation for Message Redelivery. The issues you need to consider are:

  • The redelivery delay (you indicated 3 minutes).
  • The number of times the message should be redelivered.
  • If you elect not to redeliver indefinitely, the final action that occurs when the last redelivery attempt fails which could be:
    • Drop the message.
    • Enqueue the message to the designated DLQ.
    • Enqueue the message to some other queue.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号