Skip to content

Commit 5694b4c

Browse files
Revert "Use queue name if necessary as routing key in consumers"
This reverts commit 8199bf7. See #54. References #45.
1 parent 985be9e commit 5694b4c

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/main/java/com/rabbitmq/perf/Consumer.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class Consumer extends ProducerConsumerBase implements Runnable {
3333

3434
private ConsumerImpl q;
3535
private final Channel channel;
36-
private String routingKey;
36+
private final String routingKey;
3737
private final List<String> queueNames;
3838
private final int txSize;
3939
private final boolean autoAck;
@@ -92,10 +92,6 @@ public void run() {
9292
}
9393
}
9494

95-
public void setRoutingKey(String routingKey) {
96-
this.routingKey = routingKey;
97-
}
98-
9995
private class ConsumerImpl extends DefaultConsumer {
10096
long now;
10197
int totalMsgCount = 0;
@@ -135,6 +131,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, BasicPropertie
135131
}
136132

137133
now = System.currentTimeMillis();
134+
138135
stats.handleRecv(routingKey.equals(envelope.getRoutingKey()) ? (nano - msgNano) : 0L);
139136
if (rateLimit > 0.0f) {
140137
delay(now);

src/main/java/com/rabbitmq/perf/MulticastSet.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import java.net.URISyntaxException;
2323
import java.security.KeyManagementException;
2424
import java.security.NoSuchAlgorithmException;
25-
import java.util.ArrayList;
26-
import java.util.Collection;
2725
import java.util.HashSet;
2826
import java.util.List;
2927
import java.util.Random;
@@ -76,7 +74,6 @@ public void run() throws IOException, InterruptedException, TimeoutException, No
7674
public void run(boolean announceStartup)
7775
throws IOException, InterruptedException, TimeoutException, NoSuchAlgorithmException, KeyManagementException, URISyntaxException {
7876
Set<String> queueNames = new HashSet<>();
79-
Collection<Consumer> consumers = new ArrayList<>();
8077
Thread[] consumerThreads = new Thread[params.getConsumerThreadCount()];
8178
Connection[] consumerConnections = new Connection[params.getConsumerCount()];
8279
for (int i = 0; i < consumerConnections.length; i++) {
@@ -91,7 +88,6 @@ public void run(boolean announceStartup)
9188
System.out.println("id: " + testID + ", starting consumer #" + i + ", channel #" + j);
9289
}
9390
Consumer consumer = params.createConsumer(conn, stats, routingKey);
94-
consumers.add(consumer);
9591
queueNames.addAll(consumer.getQueueNames());
9692
Thread t = new Thread(consumer);
9793
consumerThreads[(i * params.getConsumerChannelCount()) + j] = t;
@@ -115,12 +111,6 @@ public void run(boolean announceStartup)
115111
producersRoutingKey = this.routingKey;
116112
}
117113

118-
// consumers need the publishing routing key to match it against
119-
// against the received message and update the stats
120-
for (Consumer consumer : consumers) {
121-
consumer.setRoutingKey(producersRoutingKey);
122-
}
123-
124114
Thread[] producerThreads = new Thread[params.getProducerThreadCount()];
125115
Connection[] producerConnections = new Connection[params.getProducerCount()];
126116
for (int i = 0; i < producerConnections.length; i++) {

0 commit comments

Comments
 (0)