@@ -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