Search code examples
javaapache-cameljmsamqp

AMQP redelivery policy


I'm using Apache Camel AMQP Component with Azure Service Bus. I want to add a redelivery policy as it's possible to do for ActiveMQ:

private void addRedeliveryPolicy(ActiveMQConnectionFactory factory) {
    RedeliveryPolicy policy = factory.getRedeliveryPolicy();
    policy.setMaximumRedeliveries(5);
    policy.setMaximumRedeliveryDelay(10000);
    policy.setInitialRedeliveryDelay(10);
    policy.setRedeliveryDelay(30);
}

In a case of AMQPComponent in redelivery policy exists single getter:

private void addRedeliveryPolicy(JmsConnectionFactory factory) {
    JmsRedeliveryPolicy defaultCallbackRedeliveryPolicy = factory.getRedeliveryPolicy();
    factory.getRedeliveryPolicy().getMaxRedeliveries(...);
}

Using standard AMQP and Qpid libraries. Question - how to set the redelivery features as: redeliveryDalay, redeliveryAttempts, for the AMQP component?


Solution

  • The AMQP JMS client does not support that same configuration options as the Openwire JMS client. The primary reason for this is that unlike the Openwire client redelivery does not happen locally on the AMQP JMS client but instead the message are released back to the broker for redispatch. This means that any delay processing or other mechanics would need to be done at the broker side not on the client.

    The only option currently in the client is a max redelivery options which is applied based on the AMQP delivery count that is tracked as part of the message transfer.