Calling ActiveMQConnection.setClientID() twice currently raises an IllegalStateException:
This successfully prevents from overriding clientID on an already started connection.
However in the case of using a Camel JMS endpoint with durable subscriptions, transactions and configuring for a PooledConnectionFactory, this current behavior causes problems.
Due to the durable sub a clientID needs to be set on the connection. This happens at startup of the JMS consumer by calling ActiveMQConnection.setClientID().
If you stop the Camel route, the connection will be released back to the pool with the clientID remaining.
If you restart the Camel route, it will setup a new Spring DMLC and reinitialize the connection with the configured clientId. A new connection is obtained from the pool and setClientID() is invoked on that connection. This will raise the above Exception.
If we try to set the same clientID on the PooledConnection again, we should simply ignore the call rather than raising an exception.This allows the camel-jms consumer to be restarted.
Without a fix, its impossible restart a Camel route that uses camel-jms with durable subscriptions and the PooledConnectionFactory.