Red Hat AMQ 6
As of February 2025, Red Hat is no longer supporting Red Hat AMQ 6. If you are using AMQ 6, please upgrade: Migrating to AMQ 7.Questo contenuto non è disponibile nella lingua selezionata.
Chapter 8. Message Redelivery
Overview Copia collegamentoCollegamento copiato negli appunti!
- A transacted session is used and
rollback()
is called. - A transacted session is closed before commit is called.
- A session is using
CLIENT_ACKNOWLEDGE
andSession.recover()
is called.
- On the broker, using the broker's redelivery plug-in,
- On the connection factory, using the connection URI,
- On the connection, using the
RedeliveryPolicy
, - On destinations, using the connection's
RedeliveryPolicyMap
.
Redelivery properties Copia collegamentoCollegamento copiato negli appunti!
Option | Default | Description |
---|---|---|
collisionAvoidanceFactor | 0.15 | Specifies the percentage of range of collision avoidance. |
maximumRedeliveries | 6 | Specifies the maximum number of times a message will be redelivered before it is considered a poisoned pill and returned to the broker so it can go to a dead letter queue. -1 specifies an infinite number of redeliveries. |
maximumRedeliveryDelay | -1 | Specifies the maximum delivery delay that will be applied if the useExponentialBackOff option is set. -1 specifies that no maximum be applied. |
initialRedeliveryDelay | 1000 | Specifies the initial redelivery delay in milliseconds. |
redeliveryDelay | 1000 | Specifies the delivery delay, in milliseconds, if initialRedeliveryDelay is 0. |
useCollisionAvoidance | false | Specifies if the redelivery policy uses collision avoidance. |
useExponentialBackOff | false | Specifies if the redelivery time out should be increased exponentially. |
backOffMultiplier | 5 | Specifies the back-off multiplier. |
Configuring the broker's redelivery plug-in Copia collegamentoCollegamento copiato negli appunti!
maximumRedeliveries
to 0 on the destination).
redeliveryPlugin
element. As shown in Example 8.1, “Configuring the Redelivery Plug-In” this element is a child of the broker's plugins
element and contains a policy map defining the desired behavior.
Example 8.1. Configuring the Redelivery Plug-In
- 1
- The
redeliveryPolicyEntries
element contains a list ofredeliveryPolicy
elements that configures redelivery policies on a per-destination basis. - 2
- The
defaultEntry
element contains a singleredeliveryPolicy
element that configures the redelivery policy used by all destinations that do not match the one with a specific policy.
Configuring the redelivery using the broker URI Copia collegamentoCollegamento copiato negli appunti!
Example 8.2. Setting the Redelivery Policy using a Connection URI
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=4");
ActiveMQConnectionFactory connectionFactory =
new ActiveMQConnectionFactory("tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=4");
Setting the redelivery policy on a connection Copia collegamentoCollegamento copiato negli appunti!
ActiveMQConnection
class' getRedeliveryPolicy()
method allows you to configure the redelivery policy for all consumer's using that connection.
getRedeliveryPolicy()
returns a RedeliveryPolicy
object that controls the redelivery policy for the connection. The RedeliveryPolicy
object has setters for each of the properties listed in Table 8.1, “Redelivery Policy Options”.
Example 8.3. Setting the Redelivery Policy for a Connection
Setting the redelivery policy on a destination Copia collegamentoCollegamento copiato negli appunti!
ActiveMQConnection
class' getRedeliveryPolicyMap()
method returns a RedeliveryPolicyMap
object that is a map of RedeliveryPolicy
objects with destination names as the key.
RedeliveryPolicy
object controls the redelivery policy for all destinations whose name match the destination name specified in the map's key.
FRED.JOE
can only be redelivered 4 times.
Example 8.4. Setting the Redelivery Policy for a Destination