]
Marek Schmidt updated DROOLS-1184:
----------------------------------
Component/s: kie server
[kie-server-client] JMS configuration username/password overrides JMS
connection factory username/password
----------------------------------------------------------------------------------------------------------
Key: DROOLS-1184
URL:
https://issues.jboss.org/browse/DROOLS-1184
Project: Drools
Issue Type: Bug
Components: kie server
Reporter: Radek Koubský
Assignee: Mark Proctor
If a user wants to use custom username/password for JMS client, the JMS client overrides
the JMS connection factory username/password when creating a connection to JMS. This
results to invalid username/password for a JMS broker.
Client code using JMS:
{code:java}
protected ServiceResponsesList executeJmsCommand( CommandScript command, String
classType, String targetCapability, String containerId ) {
ConnectionFactory factory = config.getConnectionFactory();
Queue sendQueue = config.getRequestQueue();
Queue responseQueue = config.getResponseQueue();
Connection connection = null;
Session session = null;
ServiceResponsesList cmdResponse = null;
String corrId = UUID.randomUUID().toString();
String selector = "JMSCorrelationID = '" + corrId +
"'";
try {
// setup
MessageProducer producer;
MessageConsumer consumer;
try {
if( config.getPassword() != null ) {
connection = factory.createConnection(config.getUserName(),
config.getPassword());
} else {
connection = factory.createConnection();
}
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
producer = session.createProducer(sendQueue);
consumer = session.createConsumer(responseQueue, selector);
connection.start();
} catch( JMSException jmse ) {
throw new KieServicesException("Unable to setup a JMS
connection.", jmse);
}
..........
}
{code}