Skip to content

Commit

Permalink
GH-2760: Fix endless loop in the DirectMessageListenerContainer
Browse files Browse the repository at this point in the history
Fixes: #2760

When the application starts, a message is sent to another service.
During the start, the Rabbitmq broker crashed and the application began to write endlessly to the log line until it ran out of disk space.
The line was written to the log is `DEBUG(org.springframework.amqp.rabbit.listener.DirectReplyToMessageListenerContainer): Consume from queue amq.rabbitmq.reply-to ignore, container stopping`

(cherry picked from commit dd6a171)
  • Loading branch information
artembilan authored and spring-builds committed Jul 30, 2024
1 parent 6a0f98a commit 2366e92
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ public void addQueues(Queue... queues) {
Assert.noNullElements(queues, "'queues' cannot contain null elements");
try {
Arrays.stream(queues)
.map(Queue::getActualName)
.forEach(this.removedQueues::remove);
.map(Queue::getActualName)
.forEach(this.removedQueues::remove);
addQueues(Arrays.stream(queues).map(Queue::getName));
}
catch (AmqpIOException e) {
Expand Down Expand Up @@ -340,8 +340,9 @@ private void adjustConsumers(int newCount) {
checkStartState();
this.consumersToRestart.clear();
for (String queue : getQueueNames()) {
while (this.consumersByQueue.get(queue) == null
|| this.consumersByQueue.get(queue).size() < newCount) { // NOSONAR never null
while (isActive() &&
(this.consumersByQueue.get(queue) == null
|| this.consumersByQueue.get(queue).size() < newCount)) { // NOSONAR never null
List<SimpleConsumer> cBQ = this.consumersByQueue.get(queue);
int index = 0;
if (cBQ != null) {
Expand Down

0 comments on commit 2366e92

Please sign in to comment.