Username/password ignored when connectionFactory is set in JMS component
------------------------------------------------------------------------
Key: CAMEL-4329
URL: https://issues.apache.org/jira/browse/CAMEL-4329
Project: Camel
Issue Type: Bug
Components: camel-jms
Affects Versions: 2.8.0
Environment: irrelevant
Reporter: Sergey Zolotaryov
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);]
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira