rabbitmq – What is publisher Returns in Spring AMQP

rabbitmq – What is publisher Returns in Spring AMQP

Short answer from the link https://www.rabbitmq.com/confirms.html :

For unroutable messages, the broker will issue a confirm once the exchange verifies a message wont route to any queue (returns an empty list of queues). If the message is also published as mandatory, the basic.return is sent to the client before basic.ack.

In Spring AMQP if you set spring.rabbitmq.publisherReturns to true this will mean messages will be mandatory (unless you set mandatory to false) because of the following code:

    private boolean determineMandatoryFlag() {
        Boolean mandatory = this.properties.getTemplate().getMandatory();
        return (mandatory != null ? mandatory : this.properties.isPublisherReturns());
    }

I suggest you to read this article. There is a good description of all possible acknowledgments scenarios, including returns for the unrouted messages, like your non-existing queue.

From the Spring AMQP perspective you should bear in mind: https://docs.spring.io/spring-amqp/docs/2.0.3.RELEASE/reference/html/_reference.html#template-confirms

This feature requires a CachingConnectionFactory that has its publisherReturns property set to true.

rabbitmq – What is publisher Returns in Spring AMQP

Leave a Reply

Your email address will not be published. Required fields are marked *