[ https://issues.apache.org/activemq/browse/AMQ-2632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62989#action_62989 ] Michael Zamir edited comment on AMQ-2632 at 11/4/10 3:18 AM: ------------------------------------------------------------- This fix seems to create another bug for us: Till now, if the broker was not configured with *FaultTolerantConfiguration* , then no *ConnectionControl* was sent to the client. Now, since the *ActiveMQConnection.info.manageable* is always *true*, then we always return a *ConnectionControl*, wich means the client can no more decide which broker it should connect to. So, there's two options I can see: In *TransportConnection.java* *public Response processAddConnection(ConnectionInfo info) throws Exception {* ..... Write the old code: {code:title=TransportConnection.java|borderStyle=solid} if (info.isManageable() && broker.isFaultTolerantConfiguration()) { // send ConnectionCommand ConnectionControl command = this.connector.getConnectionControl(); command.setFaultTolerant(broker.isFaultTolerantConfiguration()); dispatchAsync(command); } {code} Instead of {code:title=TransportConnection.java|borderStyle=solid} if (info.isManageable()) { // send ConnectionCommand ConnectionControl command = this.connector.getConnectionControl(); command.setFaultTolerant(broker.isFaultTolerantConfiguration()); dispatchAsync(command); } {code} or another option will to modify the *ActiveMQConnection.info.manageable* default value (currently, it's *true*): {code:title=ActiveMQConnection.java|borderStyle=solid} protected ActiveMQConnection(final Transport transport, IdGenerator clientIdGenerator, JMSStatsImpl factoryStats) throws Exception { this.transport = transport; this.clientIdGenerator = clientIdGenerator; this.factoryStats = factoryStats; // Configure a single threaded executor who's core thread can timeout if // idle executor = new ThreadPoolExecutor(1, 1, 5, TimeUnit.SECONDS, new LinkedBlockingQueue(), new ThreadFactory() { public Thread newThread(Runnable r) { Thread thread = new Thread(r, "ActiveMQ Connection Executor: " + transport); thread.setDaemon(true); return thread; } }); // asyncConnectionThread.allowCoreThreadTimeOut(true); String uniqueId = CONNECTION_ID_GENERATOR.generateId(); this.info = new ConnectionInfo(new ConnectionId(uniqueId)); // ************************************** CHANGE HERE this.info.setManageable(true); // this should be not HARDCODED (only a suggestion/option) // ************************************** this.info.setFaultTolerant(transport.isFaultTolerant()); this.connectionSessionId = new SessionId(info.getConnectionId(), -1); this.transport.setTransportListener(this); this.stats = new JMSConnectionStatsImpl(sessions, this instanceof XAConnection); this.factoryStats.addConnection(this); this.timeCreated = System.currentTimeMillis(); this.connectionAudit.setCheckForDuplicates(transport.isFaultTolerant()); this.scheduler = new Scheduler("ActiveMQConnection["+uniqueId+"] Scheduler"); this.scheduler.start(); } {code} Hope it's clear enough. Since I'm new in ActiveMQ community, I prefer not to open a new bug but just to comment on this one. Comments are more than welcomed. was (Author: michzem): This fix seems to create another bug for us: Till now, if the broker was not configured with *FaultTolerantConfiguration* , then no *ConnectionControl* was sent to the client. Now, since the *ActiveMQConnection.info.manageable* is always *true*, then we always return a *ConnectionControl*, wich means the client can no more decide which broker it should connect to. So, there's two options I can see: In *TransportConnection.java* *public Response processAddConnection(ConnectionInfo info) throws Exception {* ..... Write the old code: {code:title=TransportConnection.java|borderStyle=solid} if (info.isManageable() && broker.isFaultTolerantConfiguration()) { // send ConnectionCommand ConnectionControl command = new ConnectionControl(); command.setFaultTolerant(broker.isFaultTolerantConfiguration()); dispatchAsync(command); } {code} Instead of {code:title=TransportConnection.java|borderStyle=solid} if (info.isManageable() ) { // send ConnectionCommand ConnectionControl command = new ConnectionControl(); command.setFaultTolerant(broker.isFaultTolerantConfiguration()); dispatchAsync(command); } {code} or another option will to : {code:title=ActiveMQConnection.java|borderStyle=solid} protected ActiveMQConnection(final Transport transport, IdGenerator clientIdGenerator, JMSStatsImpl factoryStats) throws Exception { this.transport = transport; this.clientIdGenerator = clientIdGenerator; this.factoryStats = factoryStats; // Configure a single threaded executor who's core thread can timeout if // idle executor = new ThreadPoolExecutor(1, 1, 5, TimeUnit.SECONDS, new LinkedBlockingQueue(), new ThreadFactory() { public Thread newThread(Runnable r) { Thread thread = new Thread(r, "ActiveMQ Connection Executor: " + transport); thread.setDaemon(true); return thread; } }); // asyncConnectionThread.allowCoreThreadTimeOut(true); String uniqueId = CONNECTION_ID_GENERATOR.generateId(); this.info = new ConnectionInfo(new ConnectionId(uniqueId)); this.info.setManageable(true); // this should be not HARDCODED (only a suggestion/option) this.info.setFaultTolerant(transport.isFaultTolerant()); this.connectionSessionId = new SessionId(info.getConnectionId(), -1); this.transport.setTransportListener(this); this.stats = new JMSConnectionStatsImpl(sessions, this instanceof XAConnection); this.factoryStats.addConnection(this); this.timeCreated = System.currentTimeMillis(); this.connectionAudit.setCheckForDuplicates(transport.isFaultTolerant()); this.scheduler = new Scheduler("ActiveMQConnection["+uniqueId+"] Scheduler"); this.scheduler.start(); } {code} Hope it's clear enough. Since I'm new in ActiveMQ community, I prefer not to open a new bug but just to comment on this one. Comments are more than welcomed. > Update client connections with information about a cluster of networked brokers > ------------------------------------------------------------------------------- > > Key: AMQ-2632 > URL: https://issues.apache.org/activemq/browse/AMQ-2632 > Project: ActiveMQ > Issue Type: Improvement > Components: JMS client > Affects Versions: 5.0.0, 5.1.0, 5.2.0, 5.3.0 > Reporter: Rob Davies > Assignee: Rob Davies > Fix For: 5.4.0 > > > Currently it is up to the client to decide which broker(s) it should connect to. It would be beneficial to allow clients to be informed of brokers joining/leaving a cluster of networked brokers, and optionally load balance across them. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.