Skip to content

Commit ce326b9

Browse files
committed
AMQP-836: Revert
This was not an issue in 2.0.x since the super class `add/removeQueues` delegates to `add/removeQueueNames`. So, this change causes the consumers to be cycled twice. Revert the src/main changes but retain the test.
1 parent 8c0a33c commit ce326b9

File tree

2 files changed

+3
-34
lines changed

2 files changed

+3
-34
lines changed

spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/AbstractMessageListenerContainer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -305,7 +305,7 @@ public void addQueueNames(String... queueNames) {
305305
* Add queue(s) to this container's list of queues.
306306
* @param queues The queue(s) to add.
307307
*/
308-
public void addQueues(Queue... queues) {
308+
public final void addQueues(Queue... queues) {
309309
addQueueNames(collectQueueNames(queues));
310310
}
311311

@@ -325,7 +325,7 @@ public boolean removeQueueNames(String... queueNames) {
325325
* @param queues The queue(s) to remove.
326326
* @return the boolean result of removal on the target {@code queueNames} List.
327327
*/
328-
public boolean removeQueues(Queue... queues) {
328+
public final boolean removeQueues(Queue... queues) {
329329
return removeQueueNames(collectQueueNames(queues));
330330
}
331331

spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/SimpleMessageListenerContainer.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.springframework.amqp.ImmediateAcknowledgeAmqpException;
4242
import org.springframework.amqp.core.AcknowledgeMode;
4343
import org.springframework.amqp.core.Message;
44-
import org.springframework.amqp.core.Queue;
4544
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
4645
import org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils;
4746
import org.springframework.amqp.rabbit.connection.ConsumerChannelRegistry;
@@ -370,36 +369,6 @@ public boolean removeQueueNames(String... queueName) {
370369
}
371370
}
372371

373-
/**
374-
* Add queue(s) to this container's list of queues. The existing consumers
375-
* will be cancelled after they have processed any pre-fetched messages and
376-
* new consumers will be created. The queue must exist to avoid problems when
377-
* restarting the consumers.
378-
* @param queue The queue to add.
379-
*/
380-
@Override
381-
public void addQueues(Queue... queue) {
382-
super.addQueues(queue);
383-
queuesChanged();
384-
}
385-
386-
/**
387-
* Remove queues from this container's list of queues. The existing consumers
388-
* will be cancelled after they have processed any pre-fetched messages and
389-
* new consumers will be created. At least one queue must remain.
390-
* @param queue The queue to remove.
391-
*/
392-
@Override
393-
public boolean removeQueues(Queue... queue) {
394-
if (super.removeQueues(queue)) {
395-
queuesChanged();
396-
return true;
397-
}
398-
else {
399-
return false;
400-
}
401-
}
402-
403372
/**
404373
* Set the number of retries after passive queue declaration fails.
405374
* @param declarationRetries The number of retries, default 3.

0 commit comments

Comments
 (0)