Effective October 27, 2012, online and email support for FuseSource products will move to Red Hat support channels. For more information, please see the JIRA Migration to Red Hat FAQ.
As of October 27th, please open all new issues in the Red Hat Customer Portal .
Issue Details (XML | Word | Printable)

Key: MB-1106
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Gary Tully
Reporter: Torsten Mielke
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
FUSE Message Broker

Repeated call to PooledConnection.setClientID() with the same clientId should not raise a IllegalStateException("Setting clientID on a used Connection is not allowed")

Created: 28/Feb/12 01:29 PM   Updated: 02/Mar/12 03:48 PM
Component/s: broker
Affects Version/s: 5.5.1-fuse-02-02
Fix Version/s: 5.5.0-fuse-00-xx, 5.5.1-fuse-03-04

File Attachments: 1. Text File MB-1106.patch (4 kB)


External Issue URL: https://issues.apache.org/jira/browse/AMQ-3752


 Description  « Hide
Calling ActiveMQConnection.setClientID() twice currently raises an IllegalStateException:
ActiveMQConnection.java
public void setClientID(String newClientID) throws JMSException {
        checkClosedOrFailed();

        if (this.isConnectionInfoSentToBroker) {
            throw new IllegalStateException("Setting clientID on a used Connection is not allowed");
        }
        
        this.info.setClientId(newClientID);
        this.userSpecifiedClientID = true;
        ensureConnectionInfoSent();
    }

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.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Torsten Mielke added a comment - 28/Feb/12 04:48 PM
Proposed fix including JUnit test.

Gary Tully added a comment - 02/Mar/12 01:16 PM
fix on 5.5.x and 5.5.1