You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2019/06/26 19:23:13 UTC

[activemq-artemis] 01/03: ARTEMIS-2403 Consumer command, clientID is ignored on CLI during retry connection with stdin input

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 741fd433c0b729f5beb69fae1c55649e3dfe8e52
Author: Shailendra Kumar Singh <sh...@gmail.com>
AuthorDate: Wed Jun 26 12:37:30 2019 +0530

    ARTEMIS-2403 Consumer command, clientID is ignored on CLI during retry connection with stdin input
---
 .../cli/commands/messages/ConnectionAbstract.java  | 24 ++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/ConnectionAbstract.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/ConnectionAbstract.java
index 90882e6..a4a1f1e 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/ConnectionAbstract.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/ConnectionAbstract.java
@@ -72,13 +72,21 @@ public class ConnectionAbstract extends InputAbstract {
          // if a security exception will get the user and password through an input
          context.err.println("Connection failed::" + e.getMessage());
          userPassword();
-         return new JmsConnectionFactory(user, password, brokerURL);
+         cf = new JmsConnectionFactory(user, password, brokerURL);
+         if (clientID != null) {
+            cf.setClientID(clientID);
+         }
+         return cf;
       } catch (JMSException e) {
          // if a connection exception will ask for the URL, user and password
          context.err.println("Connection failed::" + e.getMessage());
          brokerURL = input("--url", "Type in the broker URL for a retry (e.g. tcp://localhost:61616)", brokerURL);
          userPassword();
-         return new JmsConnectionFactory(user, password, brokerURL);
+         cf = new JmsConnectionFactory(user, password, brokerURL);
+         if (clientID != null) {
+            cf.setClientID(clientID);
+         }
+         return cf;
       }
    }
 
@@ -97,13 +105,21 @@ public class ConnectionAbstract extends InputAbstract {
          // if a security exception will get the user and password through an input
          context.err.println("Connection failed::" + e.getMessage());
          userPassword();
-         return new ActiveMQConnectionFactory(brokerURL, user, password);
+         cf = new ActiveMQConnectionFactory(brokerURL, user, password);
+         if (clientID != null) {
+            cf.setClientID(clientID);
+         }
+         return cf;
       } catch (JMSException e) {
          // if a connection exception will ask for the URL, user and password
          context.err.println("Connection failed::" + e.getMessage());
          brokerURL = input("--url", "Type in the broker URL for a retry (e.g. tcp://localhost:61616)", brokerURL);
          userPassword();
-         return new ActiveMQConnectionFactory(brokerURL, user, password);
+         cf = new ActiveMQConnectionFactory(brokerURL, user, password);
+         if (clientID != null) {
+            cf.setClientID(clientID);
+         }
+         return cf;
       }
    }