GH-184: Don't declare queue if bindQueue is false

Resolves https://github.com/spring-cloud/spring-cloud-stream-binder-rabbit/issues/184

Resolves #185
This commit is contained in:
Gary Russell
2018-10-16 15:19:38 -04:00
committed by Oleg Zhurakousky
parent 7eaef3a7c0
commit 444123cdb4
2 changed files with 9 additions and 9 deletions

View File

@@ -130,7 +130,7 @@ For partitioned destinations, `-<instanceIndex>` is appended.
+
Default: `#`.
bindQueue::
Whether to bind the queue to the destination exchange.
Whether to declare the queue and bind it to the destination exchange.
Set it to `false` if you have set up your own infrastructure and have previously created and bound the queue.
+
Default: `true`.
@@ -380,7 +380,7 @@ Only applies if `requiredGroups` are provided and then only to those groups.
+
Default: `#`.
bindQueue::
Whether to bind the queue to the destination exchange.
Whether to declare the queue and bind it to the destination exchange.
Set it to `false` if you have set up your own infrastructure and have previously created and bound the queue.
Only applies if `requiredGroups` are provided and then only to those groups.
+

View File

@@ -101,11 +101,11 @@ public class RabbitExchangeQueueProvisioner implements ApplicationListener<Decla
String baseQueueName = producerProperties.getExtension().isQueueNameGroupOnly()
? requiredGroupName : (exchangeName + "." + requiredGroupName);
if (!producerProperties.isPartitioned()) {
Queue queue = new Queue(baseQueueName, true, false, false,
queueArgs(baseQueueName, producerProperties.getExtension(), false));
declareQueue(baseQueueName, queue);
autoBindDLQ(baseQueueName, baseQueueName, producerProperties.getExtension());
if (producerProperties.getExtension().isBindQueue()) {
Queue queue = new Queue(baseQueueName, true, false, false,
queueArgs(baseQueueName, producerProperties.getExtension(), false));
declareQueue(baseQueueName, queue);
binding = notPartitionedBinding(exchange, queue, producerProperties.getExtension());
}
}
@@ -114,11 +114,11 @@ public class RabbitExchangeQueueProvisioner implements ApplicationListener<Decla
for (int i = 0; i < producerProperties.getPartitionCount(); i++) {
String partitionSuffix = "-" + i;
String partitionQueueName = baseQueueName + partitionSuffix;
Queue queue = new Queue(partitionQueueName, true, false, false,
queueArgs(partitionQueueName, producerProperties.getExtension(), false));
declareQueue(queue.getName(), queue);
autoBindDLQ(baseQueueName, baseQueueName + partitionSuffix, producerProperties.getExtension());
if (producerProperties.getExtension().isBindQueue()) {
Queue queue = new Queue(partitionQueueName, true, false, false,
queueArgs(partitionQueueName, producerProperties.getExtension(), false));
declareQueue(queue.getName(), queue);
String prefix = producerProperties.getExtension().getPrefix();
String destination = StringUtils.isEmpty(prefix) ? exchangeName : exchangeName.substring(prefix.length());
binding = partitionedBinding(destination, exchange, queue, producerProperties.getExtension(), i);
@@ -180,9 +180,9 @@ public class RabbitExchangeQueueProvisioner implements ApplicationListener<Decla
queueArgs(queueName, properties.getExtension(), false));
}
}
declareQueue(queueName, queue);
Binding binding = null;
if (properties.getExtension().isBindQueue()) {
declareQueue(queueName, queue);
binding = declareConsumerBindings(name, properties, exchange, partitioned, queue);
}
if (durable) {