You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by pela <mp...@gmail.com> on 2013/07/24 10:26:41 UTC

JMS API failover

Hi,

I'm building a client with JMS API and want to achieve automatic
reconnection mechanism, that is when the connection to the broker is lost
the client should reconnect automatically, resubscribe queues, etc. 

I've added failover=roundrobin to my connection URL and that seems to work
even though there is only one broker in the brokerlist (it iterates over
that single broker). On the other hand, the application code is not informed
at all of the disconnection/reconnection events, because it's all done under
the hood by the API.

Is it possible some way to get some automatic reconnection mechanism, and at
the same time know when the connection is broken (to inform the end user of
the temporary disfunction of the system), and when the the connection is
re-established (to inform the end user the system has come back to
operation)?

Thanks in advance for any advice.

Regards
Marco



--
View this message in context: http://qpid.2158936.n2.nabble.com/JMS-API-failover-tp7595846.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: JMS API failover

Posted by pela <mp...@gmail.com>.
Hi Phil,

I understand I have to call the QPID concrete implementation of the JMS
Connection, rather than the Connection interface itself which does not offer
this functionality.

To recap, I need to be handle the following connection events:

1) First connection is established successfully. I can't see a specific
listener method called in this case. Should I assume the connection is
established after I have called the Connection's start()?

2) Connection broken. I think I am notified on ConnectionListener's
preFailover() method when this occurs, right?

3) Connection re-established. Should be the ConnectionListener's
failoverComplete() method as you suggested, right?


Thanks
Marco


Phil Harvey-2 wrote
> Hi Marco,
> 
> Try this:
> 
> ((AMQConnection)yourJmsConnection).setConnectionListener(
>   new org.apache.qpid.jms.ConnectionListener() {
>     ...
>     public void failoverComplete() {
>       ...
>     }
>     ...
> }
> 
> Phil
> 
> 
> 
> On 24 July 2013 09:26, pela &lt;

> mpela.gatti@

> &gt; wrote:
> 
>> Hi,
>>
>> I'm building a client with JMS API and want to achieve automatic
>> reconnection mechanism, that is when the connection to the broker is lost
>> the client should reconnect automatically, resubscribe queues, etc.
>>
>> I've added failover=roundrobin to my connection URL and that seems to
>> work
>> even though there is only one broker in the brokerlist (it iterates over
>> that single broker). On the other hand, the application code is not
>> informed
>> at all of the disconnection/reconnection events, because it's all done
>> under
>> the hood by the API.
>>
>> Is it possible some way to get some automatic reconnection mechanism, and
>> at
>> the same time know when the connection is broken (to inform the end user
>> of
>> the temporary disfunction of the system), and when the the connection is
>> re-established (to inform the end user the system has come back to
>> operation)?
>>
>> Thanks in advance for any advice.
>>
>> Regards
>> Marco
>>
>>
>>
>> --
>> View this message in context:
>> http://qpid.2158936.n2.nabble.com/JMS-API-failover-tp7595846.html
>> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: 

> users-unsubscribe@.apache

>> For additional commands, e-mail: 

> users-help@.apache

>>
>>





--
View this message in context: http://qpid.2158936.n2.nabble.com/JMS-API-failover-tp7595846p7595850.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: JMS API failover

Posted by Phil Harvey <ph...@philharveyonline.com>.
Hi Marco,

Try this:

((AMQConnection)yourJmsConnection).setConnectionListener(
  new org.apache.qpid.jms.ConnectionListener() {
    ...
    public void failoverComplete() {
      ...
    }
    ...
}

Phil



On 24 July 2013 09:26, pela <mp...@gmail.com> wrote:

> Hi,
>
> I'm building a client with JMS API and want to achieve automatic
> reconnection mechanism, that is when the connection to the broker is lost
> the client should reconnect automatically, resubscribe queues, etc.
>
> I've added failover=roundrobin to my connection URL and that seems to work
> even though there is only one broker in the brokerlist (it iterates over
> that single broker). On the other hand, the application code is not
> informed
> at all of the disconnection/reconnection events, because it's all done
> under
> the hood by the API.
>
> Is it possible some way to get some automatic reconnection mechanism, and
> at
> the same time know when the connection is broken (to inform the end user of
> the temporary disfunction of the system), and when the the connection is
> re-established (to inform the end user the system has come back to
> operation)?
>
> Thanks in advance for any advice.
>
> Regards
> Marco
>
>
>
> --
> View this message in context:
> http://qpid.2158936.n2.nabble.com/JMS-API-failover-tp7595846.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>