[jboss-jira] [JBoss JIRA] (DROOLS-1184) [kie-server-client] JMS configuration username/password overrides JMS connection factory username/password

Radek Koubský (JIRA) issues at jboss.org
Fri May 20 04:56:01 EDT 2016


Radek Koubský created DROOLS-1184:
-------------------------------------

             Summary: [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
            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}



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the jboss-jira mailing list