Skip to content

Commit 90e21b2

Browse files
author
Alexandru Scvortov
committed
change the option name for URIs in MCM; add URIs to LogTail
1 parent 2d23c4d commit 90e21b2

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@
2626
public class LogTail {
2727
public static void main(String[] args) {
2828
try {
29-
String hostName = (args.length > 0) ? args[0] : "localhost";
30-
int portNumber = (args.length > 1) ? Integer.parseInt(args[1]) : AMQP.PROTOCOL.PORT;
31-
String exchange = (args.length > 2) ? args[2] : "amq.rabbitmq.log";
29+
ConnectionFactory cfconn = new ConnectionFactory();
30+
if (args.length > 0) {
31+
cfconn.setUri(args[0]);
32+
}
33+
String exchange = (args.length > 1) ? args[1] : "amq.rabbitmq.log";
3234

33-
ConnectionFactory cfconn = new ConnectionFactory();
34-
cfconn.setHost(hostName);
35-
cfconn.setPort(portNumber);
3635
Connection conn = cfconn.newConnection();
37-
3836
Channel ch1 = conn.createChannel();
3937

4038
String queueName = ch1.queueDeclare().getQueue();

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ public static void main(String[] args) {
6464
System.exit(0);
6565
}
6666

67-
String hostName = strArg(cmd, 'h', "localhost");
68-
int portNumber = intArg(cmd, 'p', AMQP.PROTOCOL.PORT);
6967
String exchangeType = strArg(cmd, 't', "direct");
7068
String exchangeName = strArg(cmd, 'e', exchangeType);
7169
String queueName = strArg(cmd, 'u', "");
@@ -83,7 +81,7 @@ public static void main(String[] args) {
8381
List<?> flags = lstArg(cmd, 'f');
8482
int frameMax = intArg(cmd, 'M', 0);
8583
int heartbeat = intArg(cmd, 'b', 0);
86-
String uri = strArg(cmd, 'u', null);
84+
String uri = strArg(cmd, 'h', "amqp://localhost");
8785

8886
boolean exclusive = "".equals(queueName);
8987
boolean autoDelete = !exclusive;
@@ -92,12 +90,7 @@ public static void main(String[] args) {
9290
String id = UUID.randomUUID().toString();
9391
Stats stats = new Stats(1000L * samplingInterval);
9492
ConnectionFactory factory = new ConnectionFactory();
95-
if (uri != null) {
96-
factory.setUri(uri);
97-
} else {
98-
factory.setHost(hostName);
99-
factory.setPort(portNumber);
100-
}
93+
factory.setUri(uri);
10194
factory.setRequestedFrameMax(frameMax);
10295
factory.setRequestedHeartbeat(heartbeat);
10396

@@ -181,8 +174,7 @@ private static void usage(Options options) {
181174
private static Options getOptions() {
182175
Options options = new Options();
183176
options.addOption(new Option("?", "help", false,"show usage"));
184-
options.addOption(new Option("h", "host", true, "broker host"));
185-
options.addOption(new Option("p", "port", true, "broker port"));
177+
options.addOption(new Option("h", "uri", true, "AMQP URI"));
186178
options.addOption(new Option("t", "type", true, "exchange type"));
187179
options.addOption(new Option("e", "exchange", true, "exchange name"));
188180
options.addOption(new Option("u", "queue", true, "queue name"));
@@ -202,7 +194,6 @@ private static Options getOptions() {
202194
options.addOption(flag);
203195
options.addOption(new Option("M", "framemax", true, "frame max"));
204196
options.addOption(new Option("b", "heartbeat", true, "heartbeat interval"));
205-
options.addOption(new Option("u", "uri", true, "AMQP URI"));
206197
return options;
207198
}
208199

0 commit comments

Comments
 (0)