Skip to content

Commit

Permalink
AMQP-836: Revert
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
garyrussell committed Oct 15, 2018
1 parent 8c0a33c commit ce326b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -305,7 +305,7 @@ public void addQueueNames(String... queueNames) {
* Add queue(s) to this container's list of queues.
* @param queues The queue(s) to add.
*/
public void addQueues(Queue... queues) {
public final void addQueues(Queue... queues) {
addQueueNames(collectQueueNames(queues));
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import org.springframework.amqp.ImmediateAcknowledgeAmqpException;
import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils;
import org.springframework.amqp.rabbit.connection.ConsumerChannelRegistry;
Expand Down Expand Up @@ -370,36 +369,6 @@ public boolean removeQueueNames(String... queueName) {
}
}

/**
* Add queue(s) to this container's list of queues. The existing consumers
* will be cancelled after they have processed any pre-fetched messages and
* new consumers will be created. The queue must exist to avoid problems when
* restarting the consumers.
* @param queue The queue to add.
*/
@Override
public void addQueues(Queue... queue) {
super.addQueues(queue);
queuesChanged();
}

/**
* Remove queues from this container's list of queues. The existing consumers
* will be cancelled after they have processed any pre-fetched messages and
* new consumers will be created. At least one queue must remain.
* @param queue The queue to remove.
*/
@Override
public boolean removeQueues(Queue... queue) {
if (super.removeQueues(queue)) {
queuesChanged();
return true;
}
else {
return false;
}
}

/**
* Set the number of retries after passive queue declaration fails.
* @param declarationRetries The number of retries, default 3.
Expand Down

0 comments on commit ce326b9

Please sign in to comment.