Skip to content

Commit 15158f0

Browse files
author
Simon MacMullen
committed
Ensure queues have unique names. Make them exclusive (previously they were autodelete but exclusive seems to make more sense). Only make them durable if messages are persistent (slight ugliness when running separate processes).
1 parent ac47355 commit 15158f0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/src/com/rabbitmq/examples/MulticastMain.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ public static void main(String[] args) {
105105
Channel channel = conn.createChannel();
106106
if (consumerTxSize > 0) channel.txSelect();
107107
channel.exchangeDeclare(exchangeName, exchangeType);
108-
String queueName = "consumer-" + i;
109-
channel.queueDeclare(queueName, true, false, false, null);
108+
String queueName = "consumer-" + UUID.randomUUID();
109+
channel.queueDeclare(queueName, flags.contains("persistent"),
110+
true, false, null);
110111
QueueingConsumer consumer = new QueueingConsumer(channel);
111112
if (prefetchCount > 0) channel.basicQos(prefetchCount);
112113
channel.basicConsume(queueName, autoAck, consumer);

0 commit comments

Comments
 (0)