ARTEMIS-2403 Consumer command, clientID is ignored on CLI during retry connection with stdin input

This commit is contained in:
Shailendra Kumar Singh 2019-06-26 12:37:30 +05:30 committed by Clebert Suconic
parent 824b732845
commit 741fd433c0
1 changed files with 20 additions and 4 deletions

View File

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