Skip to content

Commit ecefd78

Browse files
author
Emile Joubert
committed
MulticastMain routing key
1 parent 97e978a commit ecefd78

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static void main(String[] args) {
4848
String exchangeType = strArg(cmd, 't', "direct");
4949
String exchangeName = strArg(cmd, 'e', exchangeType);
5050
String queueName = strArg(cmd, 'u', "");
51+
String routingKey = strArg(cmd, 'k', null);
5152
int samplingInterval = intArg(cmd, 'i', 1);
5253
float rateLimit = floatArg(cmd, 'r', 0.0f);
5354
int producerCount = intArg(cmd, 'x', 1);
@@ -104,6 +105,7 @@ public static void main(String[] args) {
104105
p.setProducerMsgCount( producerMsgCount);
105106
p.setProducerTxSize( producerTxSize);
106107
p.setQueueName( queueName);
108+
p.setRoutingKey( routingKey);
107109
p.setRateLimit( rateLimit);
108110
p.setTimeLimit( timeLimit);
109111

@@ -134,6 +136,7 @@ private static Options getOptions() {
134136
options.addOption(new Option("t", "type", true, "exchange type"));
135137
options.addOption(new Option("e", "exchange", true, "exchange name"));
136138
options.addOption(new Option("u", "queue", true, "queue name"));
139+
options.addOption(new Option("k", "routingKey", true, "routing key"));
137140
options.addOption(new Option("i", "interval", true, "sampling interval"));
138141
options.addOption(new Option("r", "rate", true, "rate limit"));
139142
options.addOption(new Option("x", "producers", true, "producer count"));

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class MulticastParams {
4343
private String exchangeName = "direct";
4444
private String exchangeType = "direct";
4545
private String queueName = "";
46+
private String routingKey = null;
4647

4748
private List<?> flags = new ArrayList<Object>();
4849

@@ -65,6 +66,10 @@ public void setQueueName(String queueName) {
6566
this.queueName = queueName;
6667
}
6768

69+
public void setRoutingKey(String routingKey) {
70+
this.routingKey = routingKey;
71+
}
72+
6873
public void setRateLimit(float rateLimit) {
6974
this.rateLimit = rateLimit;
7075
}
@@ -150,6 +155,10 @@ public int getMinMsgSize() {
150155
return minMsgSize;
151156
}
152157

158+
public String getRoutingKey() {
159+
return routingKey;
160+
}
161+
153162
public Producer createProducer(Connection connection, Stats stats, String id) throws IOException {
154163
Channel channel = connection.createChannel();
155164
if (producerTxSize > 0) channel.txSelect();

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ public class MulticastSet {
3131

3232
public MulticastSet(Stats stats, ConnectionFactory factory,
3333
MulticastParams params) {
34-
this.id = UUID.randomUUID().toString();
34+
if (params.getRoutingKey() == null) {
35+
this.id = UUID.randomUUID().toString();
36+
} else {
37+
this.id = params.getRoutingKey();
38+
}
3539
this.stats = stats;
3640
this.factory = factory;
3741
this.params = params;

0 commit comments

Comments
 (0)