Hi Dejan,

Thanks for figuring that out.  I've open an JIRA issue to trace the
resolution of the problem.
http://issues.apache.org/activemq/browse/AMQ-796

On 7/5/06, Dejan Bosanac <[EMAIL PROTECTED]> wrote:

Hi,

after some experiments I found that this problem only exists if there are
no
other threads in the application. It seems like connection thread dies
before it manages to reconnect. By starting another thread in the
application, it succeeds to recover from master failure and reconnect to
the
slave broker. So I have a workaround for now, but it would be nice to make
this work even for simple (single-threaded) clients.

Regards,
Dejan

On 7/3/06, Dejan Bosanac <[EMAIL PROTECTED]> wrote:
>
> Yes,
>
> here's the URL (with replaced server names)
>
>
>
failover://(tcp://master_host:61616,tcp://slave_host:61616)?randomize=false&amp;maxReconnectAttempts=3
>
> I've added maxReconnectAttempts parameter later, so it doesn't really
> makes any difference.
>
> If you need any additional details, please let me know.
>
> Thanks,
> Dejan
>
>
> On 7/3/06, James Strachan < [EMAIL PROTECTED]> wrote:
> >
> > From your mail I couldn't see the brokerUrl you were using to connect
> > using failover to the master and slave. Are you using something like
> > the following?
> >
> > failover:tcp://master:61616,tcp://slave:61616
> >
> >
> >
> > On 7/3/06, Dejan Bosanac < [EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > I'm evaluating ActiveMQ's master-slave configuration in order to
make
> > my
> > > system more robust.
> > > I have noted that when I'm using message listeners client does not
> > reconnect
> > > to slave broker properly (when master broker goes down).
> > > Here's the example code:
> > >
> > >             Queue dest = sess.createQueue("test");
> > >             MessageConsumer consumer = sess.createConsumer(dest);
> > >
> > >             consumer.setMessageListener(new ClientReceiver());
> > >             con.start();
> > >
> > > When I stop my master broker, my client dies with the following log
> > excerpt:
> > >
> > > 2006-07-03 12:18:08,262 [7.199.103:61616] DEBUG
> > > FailoverTransport              - Transport failed, starting up
> > reconnect
> > > task
> > > java.io.EOFException
> > >     at java.io.DataInputStream.readInt (Unknown Source)
> > >     at org.apache.activemq.openwire.OpenWireFormat.unmarshal(
> > > OpenWireFormat.java:274)
> > >     at org.apache.activemq.transport.tcp.TcpTransport.run(
> > TcpTransport.java
> > > :142)
> > >     at java.lang.Thread.run(Unknown Source)
> > > 2006-07-03 12:18:08,262 [ActiveMQ Task  ] DEBUG
> > > FailoverTransport              - Attempting connect to:
> > > tcp://master_host:61616
> > >
> > > If I change the above example to consume messages directly, like
this
> > >
> > >             Queue dest = sess.createQueue("test");
> > >             MessageConsumer consumer = sess.createConsumer(dest);
> > >
> > >             con.start();
> > >             Message msg = consumer.receive();
> > >
> > > everything seems to be working fine:
> > >
> > > 2006-07-03 12:33:56,335 [7.199.103:61616] DEBUG
> > > FailoverTransport              - Transport failed, starting up
> > reconnect
> > > task
> > > java.io.EOFException
> > >     at java.io.DataInputStream.readInt(Unknown Source)
> > >     at org.apache.activemq.openwire.OpenWireFormat.unmarshal(
> > > OpenWireFormat.java:274)
> > >     at org.apache.activemq.transport.tcp.TcpTransport.run (
> > TcpTransport.java
> > > :142)
> > >     at java.lang.Thread.run(Unknown Source)
> > > 2006-07-03 12:33:56,335 [ActiveMQ Task  ] DEBUG
> > > FailoverTransport              - Attempting connect to:
> > > tcp://master_host:61616
> > > 2006-07-03 12:33:57,356 [ActiveMQ Task  ] DEBUG
> > > FailoverTransport              - Connect fail to:
> > tcp://master_host:61616,
> > > reason: java.net.ConnectException: Connection refused: connect
> > > 2006-07-03 12:33:57,356 [ActiveMQ Task  ] DEBUG
> > > FailoverTransport              - Attempting connect to:
> > > tcp://slave_host:61616
> > > 2006-07-03 12:33:57,366 [ActiveMQ Task  ] DEBUG
> > > WireFormatNegotiator           - Sending: WireFormatInfo {
version=1,
> > > properties={TightEncodingEnabled=true, TcpNoDelayEnabled=true,
> > > SizePrefixDisabled=false, StackTraceEnabled=true,
> > > MaxInactivityDuration=30000, CacheEnabled=true},
> > magic=[A,c,t,i,v,e,M,Q]}
> > > 2006-07-03 12:33:57,366 [ 47.199.98:61616] DEBUG
> > > TcpTransport                   - TCP consumer thread starting
> > > 2006-07-03 12:33:57,386 [47.199.98:61616] DEBUG
> > > WireFormatNegotiator           - Received WireFormat: WireFormatInfo
{
> >
> > > version=1, properties={StackTraceEnabled=true,
> > TightEncodingEnabled=true,
> > > TcpNoDelayEnabled=true, SizePrefixDisabled=false,
> > > MaxInactivityDuration=30000, CacheEnabled=true},
> > magic=[A,c,t,i,v,e,M,Q]}
> > > 2006-07-03 12:33:57,386 [47.199.98:61616] DEBUG
> > > WireFormatNegotiator           - tcp://slave_host/slave_ip:61616
> > before
> > > negotiation: OpenWireFormat{version=1, cacheEnabled=false,
> > > stackTraceEnabled=false, tightEncodingEnabled=false,
> > > sizePrefixDisabled=false}
> > > 2006-07-03 12:33:57,386 [47.199.98:61616] DEBUG
> > > WireFormatNegotiator           - tcp://slave_host/slave_ip:61616
after
> > > negotiation: OpenWireFormat{version=1, cacheEnabled=true,
> > > stackTraceEnabled=true, tightEncodingEnabled=true,
> > sizePrefixDisabled=false}
> > > 2006-07-03 12:33:57,396 [ActiveMQ Task  ] DEBUG
> > > FailoverTransport              - Connection established
> > > 2006-07-03 12:33:57,396 [ 47.199.98:61616] DEBUG
> > > FailoverTransport              - Waking up reconnect task
> > > 2006-07-03 12:33:57,396 [47.199.98:61616] DEBUG
> > > ResponseCorrelator             - Received unexpected response for
> > command
> > > id: 1
> > > 2006-07-03 12:33:57,406 [47.199.98:61616] DEBUG
> > > ResponseCorrelator             - Received unexpected response for
> > command
> > > id: 4
> > > 2006-07-03 12:33:57,547 [47.199.98:61616] DEBUG
> > > ResponseCorrelator             - Received unexpected response for
> > command
> > > id: 2
> > >
> > > Has anyone else had such experiences and do you know any
workarounds?
> > >
> > > Regards,
> > > Dejan
> > >
> > >
> >
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
>
>




--
Regards,
Hiram

Blog: http://hiramchirino.com

Reply via email to