Sending messages with confirmation to a full queue of limited size can lead to high channel churn #942
-
Scenario: A spring based java application client is sending messages to the exchange using the rabbitmq-java-client library and waits for confirmation of every sent message - or until a timeout happens. The problem is, that under the hood (inside the rabbitmq-java-client implementation), every "Queue full" response from RabbitMQ will lead to a closed channel. When the message rate of published messages is very high, it causes the effect that a lot of new channels will be opened and closed - and Pooled channels can not be reused anymore, because they were already closed by mentioned line of code. Is there a better way to differentiante between the "queue full" case and other potential errors and handle the different cases better inside https://github.com/rabbitmq/rabbitmq-java-client/blob/main/src/main/java/com/rabbitmq/client/impl/ChannelN.java#L241. In my opinion it is not necessary to close a channel in case of "queue full" - it can still be reused. This affects all versions of the rabbitmq-java-client. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
The method in question is Use Streaming confirms, they won't result in channel closures. |
Beta Was this translation helpful? Give feedback.
-
There's nothing much we can do as long as you use the |
Beta Was this translation helpful? Give feedback.
-
When this method ( A bit more background: Btw.: I looked at newer versions of spring (spring-amqp) and they register a ConfirmListener and catch the ack/nack confirmations but do not touch the channel afterwards. (Example: https://github.com/spring-projects/spring-amqp/blob/main/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/PublisherCallbackChannelImpl.java) |
Beta Was this translation helpful? Give feedback.
The method in question is
waitForConfirmsOrDie
, we highly do not recommend that option, and in particular in environments where nacks are likely.Use Streaming confirms, they won't result in channel closures.