On Tue, Feb 16, 2010 at 4:54 PM, James Strachan
<james.strac...@gmail.com> wrote:
> On 16 February 2010 15:38, Jean-Yves LEBLEU <jleb...@gmail.com> wrote:
>> Hi all,
>>
>> I am trying to use the failover transport
>> (failover:(tcp://localhost:61618)), and I have some questions :
>>
>> I did a test with a simple consumer in scala (see the code and log at
>> the end of the mail).
>>
>> Scenario :
>> Broker is stopped.
>> We start the consumer, it waits
>> Start the broker
>> Consumer connects and consume messages
>> Stop the broker and start the broker again
>> Consumer tries 6 times to reconnect and stop working.
>
> I wonder if you have not restarted the broker in time for the client
> to reconnect? How long does the client take to reconnect and how long
> is the broker down for?
>
> Maybe you could try increasing the amount of time the failover
> transport waits before failing to connect...
>
> http://activemq.apache.org/failover-transport-reference.html
>
> e.g. try this URL
>
> failover:(tcp://localhost:61618)?maxReconnectAttempts=1000
>
>
> BTW slightly more idiomatic Scala code for onMessage would be...
>
> def onMessage(message: Message): Unit = message match {
>  case textMessage: TextMessage =>  println("Message recieved: " +
> textMessage.getText())
>  case _ => println("Oops, not a text message")
> }
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>

James,

Thanks for the more idiomatic Scala code, we are starting to use scala
instead of java and have not explored all the scala subtelties :).

I tried with maxReconnectAttempts=1000, the consumer stops after 7
attempts to reconnect to the broker.

Regards.
Jean-Yves

Reply via email to