You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Rob Davies (JIRA)" <ji...@apache.org> on 2010/03/02 14:01:44 UTC

[jira] Created: (AMQ-2632) Update client connections with information about a cluster of networked brokers

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.3.0, 5.2.0, 5.1.0, 5.0.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.


[jira] Resolved: (AMQ-2632) Update client connections with information about a cluster of networked brokers

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies resolved AMQ-2632.
-----------------------------

    Resolution: Fixed

Fixed by SVN revision 920306

> 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.


[jira] Commented: (AMQ-2632) Update client connections with information about a cluster of networked brokers

Posted by "Michael Zamir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62989#action_62989 ] 

Michael Zamir commented on AMQ-2632:
------------------------------------

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<Runnable>(), 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.


[jira] Issue Comment Edited: (AMQ-2632) Update client connections with information about a cluster of networked brokers

Posted by "Michael Zamir (JIRA)" <ji...@apache.org>.
    [ 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:19 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 followingcode:
{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 the code committed since 5.4
{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<Runnable>(), 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 = 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<Runnable>(), 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.
  
> 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.


[jira] Commented: (AMQ-2632) Update client connections with information about a cluster of networked brokers

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63029#action_63029 ] 

Rob Davies commented on AMQ-2632:
---------------------------------

There's a property on your connections you can set to ensure they don't take updates - set updateURIsSupported = false 
e.g.:

failover:(tcp://primary:61616,tcp://secondary:61616)?updateURIsSupported=false

> 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.


[jira] Issue Comment Edited: (AMQ-2632) Update client connections with information about a cluster of networked brokers

Posted by "Michael Zamir (JIRA)" <ji...@apache.org>.
    [ 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<Runnable>(), 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<Runnable>(), 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.


[jira] Commented: (AMQ-2632) Update client connections with information about a cluster of networked brokers

Posted by "Michael Zamir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63149#action_63149 ] 

Michael Zamir commented on AMQ-2632:
------------------------------------

Thank for the prompt and good answer:)
I've inserted the change in client side, as you suggested and it worked:

I'm using 
failover:(tcp://michael:61616,tcp://luba:62616)?randomize=false&*updateURIsSupported=false*

And my client is no more updated with the full list of broker in my network. 

Thanks again.
Michael.

> 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.