@@ -156,14 +156,8 @@ public Producer createProducer(Channel channel, Stats stats, String id) throws I
156
156
157
157
public Consumer createConsumer (Channel channel , Stats stats , String id ) throws IOException {
158
158
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 );
165
160
if (prefetchCount > 0 ) channel .basicQos (prefetchCount );
166
- channel .queueBind (qName , exchangeName , id );
167
161
return new Consumer (channel , id , qName ,
168
162
consumerTxSize , autoAck , multiAckEvery ,
169
163
stats , consumerMsgCount , timeLimit );
@@ -173,12 +167,13 @@ public boolean shouldConfigureQueue() {
173
167
return consumerCount == 0 && !queueName .equals ("" );
174
168
}
175
169
176
- public void configureQueue (Channel channel , String id ) throws IOException {
170
+ public String configureQueue (Channel channel , String id ) throws IOException {
177
171
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 ;
183
178
}
184
179
}
0 commit comments