Skip to content
Advertisement

When publisher confirms are enabled, queue length limit is set and overflow is set to reject-publish,why cause in confirm callback I received is null?

I am learning Queue Length Limit(https://www.rabbitmq.com/maxlength.html), as it says, queue is set to 'x-max-length:10',and 'x-overflow:reject-publish', and also, I enable publisher confirms. So, when the number of messages in the queue reaches 10, the publisher will be informed of the reject via a basic.nack message.

And it is: my confirm callback got a false ack, but cause is null. I’m wondering shouldn’t it return something so that I can distinguish this situation. Part of the code is as follows:

JavaScript

Advertisement

Answer

Unfortunately, the AMQP protocol and Java client provides no information about why a publish failed. Only ack/nack and whether the confirmation is for multiple messages:

JavaScript

We added the cause because, in some circumstances, the framework synthesizes a nack (for example when a channel is closed while we are waiting for confirmations, where we add Channel closed by application as the cause.

The framework can’t speculate the reason for which we got a nack from the broker.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement