Example: jms.redeliveryPolicy.maximumRedeliveries
This property specifies the maximum number of times a message will be redelivered by ActiveMQ before it is considered a poisoned pill and returned to the broker, so it can go to a Dead Letter Queue (DLQ).
- 0 is used to disable redelivery
- -1 is used for unlimited redeliveries
The property can be appended to messaging.broker.url. It’s recommended that you set it to the messaging.events.repo.node.maxConsumers value, so that when the Sync Service is terminated in the middle of a repository transaction, the message goes back to the broker queue rather than the dead letter queue. By doing this, when the Sync Service comes back online, the broker sends the message again.
For example:
failover:(tcp://localhost:61616?wireFormat.maxInactivityDurationInitalDelay=30000)?timeout=3000&jms.useCompression=true&startupMaxReconnectAttempts=0&jms.redeliveryPolicy.maximumRedeliveries=10
Note: This redelivery is performed by ActiveMQ, not Apache Camel (i.e
messaging.events.repo.node.redelivery.numRetries). To put this into
perspective, consider a scenario where a message can’t be acknowledged because of a DB
exception. First, Apache Camel attempts to redeliver the message up to the maximum
configured value. If it doesn’t succeed, the message goes back to the broker, and Apache
Camel resets its redelivery counter. Then, the broker attempts to redeliver the message
based on its configured value
(jms.redeliveryPolicy.maximumRedeliveries), if each time the message is
sent and not acknowledged; Apache Camel again attempts to redeliver up to the maximum
configured value. After all the redelivery attempts performed by Camel and ActiveMQ, the
message is sent to the Dead Letter Queue.