You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jaspreet Kaur <jk...@quark.com> on 2016/12/29 10:30:59 UTC

Where can I find the JMS connection reconnection logic in activemq(-client) source?

Hi,

I am using ActiveMQ 5.14.1.
I would like to observer in source code how/on what basis a JMS client
connection & consumers are reconnected to second broker in case the first
broker has been killed.

I have create a JMS client like..
ConnectionFactory connectionFactory = (ConnectionFactory) jndiLookup(
					"ConnectionFactory",
					"org.apache.activemq.jndi.ActiveMQInitialContextFactory",
			       
"failover:(discovery://(multicast://default?wireFormat.maxInactivityDuration=0&group=qpp))");
			Connection connection = connectionFactory.createConnection();
			Session jmsSession = connection.createSession(false,
					Session.AUTO_ACKNOWLEDGE);
			Topic topic = jmsSession.createTopic("t14");
			MessageConsumer messageConsumer = jmsSession.createConsumer(topic);
			messageConsumer.setMessageListener(new QpsMessageListener());
			connection.start();
...............
..........

Thanks
Jaspreet




--
View this message in context: http://activemq.2283324.n4.nabble.com/Where-can-I-find-the-JMS-connection-reconnection-logic-in-activemq-client-source-tp4720765.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Where can I find the JMS connection reconnection logic in activemq(-client) source?

Posted by Tim Bain <tb...@alumni.duke.edu>.
https://github.com/apache/activemq/blob/master/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java

On Dec 29, 2016 3:47 AM, "Jaspreet Kaur" <jk...@quark.com> wrote:

> Hi,
>
> I am using ActiveMQ 5.14.1.
> I would like to observer in source code how/on what basis a JMS client
> connection & consumers are reconnected to second broker in case the first
> broker has been killed.
>
> I have create a JMS client like..
> ConnectionFactory connectionFactory = (ConnectionFactory) jndiLookup(
>                                         "ConnectionFactory",
>                                         "org.apache.activemq.jndi.
> ActiveMQInitialContextFactory",
>
> "failover:(discovery://(multicast://default?wireFormat.
> maxInactivityDuration=0&group=qpp))");
>                         Connection connection = connectionFactory.
> createConnection();
>                         Session jmsSession = connection.createSession(
> false,
>                                         Session.AUTO_ACKNOWLEDGE);
>                         Topic topic = jmsSession.createTopic("t14");
>                         MessageConsumer messageConsumer =
> jmsSession.createConsumer(topic);
>                         messageConsumer.setMessageListener(new
> QpsMessageListener());
>                         connection.start();
> ...............
> ..........
>
> Thanks
> Jaspreet
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Where-can-I-find-the-JMS-connection-reconnection-logic-in-
> activemq-client-source-tp4720765.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>