activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Master-slave client reconnection
Date Mon, 03 Jul 2006 11:07:37 GMT
>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 <dejan@nighttale.net> 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/

Mime
View raw message