Skip to content

Commit 7c74858

Browse files
committed
refactor
1 parent e3e1326 commit 7c74858

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

test/src/com/rabbitmq/examples/perf/MulticastParams.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,8 @@ public Producer createProducer(Channel channel, Stats stats, String id) throws I
156156

157157
public Consumer createConsumer(Channel channel, Stats stats, String id) throws IOException {
158158
if (consumerTxSize > 0) channel.txSelect();
159-
channel.exchangeDeclare(exchangeName, exchangeType);
160-
String qName =
161-
channel.queueDeclare(queueName,
162-
flags.contains("persistent"),
163-
exclusive, autoDelete,
164-
null).getQueue();
159+
String qName = configureQueue(channel, id);
165160
if (prefetchCount > 0) channel.basicQos(prefetchCount);
166-
channel.queueBind(qName, exchangeName, id);
167161
return new Consumer(channel, id, qName,
168162
consumerTxSize, autoAck, multiAckEvery,
169163
stats, consumerMsgCount, timeLimit);
@@ -173,12 +167,13 @@ public boolean shouldConfigureQueue() {
173167
return consumerCount == 0 && !queueName.equals("");
174168
}
175169

176-
public void configureQueue(Channel channel, String id) throws IOException {
170+
public String configureQueue(Channel channel, String id) throws IOException {
177171
channel.exchangeDeclare(exchangeName, exchangeType);
178-
channel.queueDeclare(queueName,
179-
flags.contains("persistent"),
180-
exclusive, autoDelete,
181-
null).getQueue();
182-
channel.queueBind(queueName, exchangeName, id);
172+
String qName = channel.queueDeclare(queueName,
173+
flags.contains("persistent"),
174+
exclusive, autoDelete,
175+
null).getQueue();
176+
channel.queueBind(qName, exchangeName, id);
177+
return qName;
183178
}
184179
}

0 commit comments

Comments
 (0)