Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-4329

Username/password ignored when connectionFactory is set in JMS component

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.0
    • 2.8.1, 2.9.0
    • camel-jms
    • None
    • irrelevant

    • Unknown

    Description

      There is a conflict between 2 properties: connectionFactory and username/password. If I set both the connectionFactory wins and jms endpoint uses connection factory that is unaware of username/password specified for the endpoint.
      We need to use both - we have different systems and use different connections factories with different username/passwords.

      Let's assume I have a setup with 2 connection factories jmsConnectionFactory1 and jmsConnectionFactory2 and an endpoint jms:queue:myQueue?connectionFactory=jmsConnectionFactory2&username=myuser&password=secret, here is what happens:

      I see that in JmsComponent:133 you retrieve the first ConnectionFactory (jmsConnectionFactory1) found in Spring.
      Then in JmsComponent:414 you create a delegating ConnectionFactory which always uses username/password (with jmsConnectionFactory1) and set it to the endpoint.
      Then in JmsComponent:434 you finally set the right ConnectionFactory (jmsConnectionFactory2) to the endpoint, though the username/password are lost forever.

      I have solved it for our project by implementing a clone of JmsComponent with overriden createEndpoint. Move line 434 [setProperties(endpoint.getConfiguration(), parameters);] a the line immediately after 407 [String password = getAndRemoveParameter(parameters, "password", String.class);]

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            anydoby Sergey Zolotaryov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: