Hi,

I'm using ActiveMQ 4.1.1 and trying to use failover. At the moment I'm doing
manual reconnects which work quite well but it would be nice to switch to
failover. I'm also using transactions. At the moment when a connection dies
the transaction aborts, I manually reconnect and try to receive again. 

With failover the reconnect happens but there are lots of transaction
warnings. Also once reconnected it seems to be in an inconsistent state
because it doesn't take messages from the queue. If I start another instance
that will take the messages and process them.

The way the transactions work are:
receive message (start transaction)
 doWork()
 write response (to different queue, same session)
commit

When the diconnect and reconnect happens during doWork() the following
exceptions happen:

23 Jan 11:37:39 INFO  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
FailoverTransport  - Transport failed, attempting to automatically reconnect
due to: java.io.EOFException
java.io.EOFException
        at java.io.DataInputStream.readInt(DataInputStream.java:358)
        at
org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:267)
        at
org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:156)
        at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:136)
        at java.lang.Thread.run(Thread.java:595)
23 Jan 11:37:39 DEBUG [ActiveMQ Task] FailoverTransport$2  - Attempting
connect to: tcp://localhost:61616
23 Jan 11:37:39 DEBUG [ActiveMQ Task] WireFormatNegotiator  - Sending:
WireFormatInfo { version=2, properties={TightEncodingEnabled=true,
CacheSize=1024, TcpNoDelayEnabled=true, SizePrefixDisabled=false,
StackTraceEnabled=true, MaxInactivityDuration=30000, CacheEnabled=true},
magic=[A,c,t,i,v,e,M,Q]}
23 Jan 11:37:39 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
WireFormatNegotiator  - Received WireFormat: WireFormatInfo { version=2,
properties={TightEncodingEnabled=true, CacheSize=1024,
TcpNoDelayEnabled=true, SizePrefixDisabled=false, StackTraceEnabled=true,
MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
23 Jan 11:37:39 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
WireFormatNegotiator  - tcp://localhost/127.0.0.1:61616 before negotiation:
OpenWireFormat{version=2, cacheEnabled=false, stackTraceEnabled=false,
tightEncodingEnabled=false, sizePrefixDisabled=false}
23 Jan 11:37:39 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
WireFormatNegotiator  - tcp://localhost/127.0.0.1:61616 after negotiation:
OpenWireFormat{version=2, cacheEnabled=true, stackTraceEnabled=true,
tightEncodingEnabled=true, sizePrefixDisabled=false}
23 Jan 11:37:39 DEBUG [ActiveMQ Task] FailoverTransport$2  - Connection
established
23 Jan 11:37:39 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1
23 Jan 11:37:39 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1457
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 546
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1408
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1426
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1416
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 571
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 636
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1536
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 616
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1398
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1490
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 589
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 556
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1373
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1506
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 1450
23 Jan 11:37:40 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616]
ResponseCorrelator  - Received unexpected response for command id: 2
JMS Exception occured. javax.jms.JMSException: Transaction
'TX:ID:vsplw04.edftrading.com-37462-1201088024192-1:0:197' has not been
started.
JMS Exception occured. javax.jms.JMSException: Transaction
'TX:ID:vsplw04.edftrading.com-37462-1201088024192-1:0:188' has not been
started.
JMS Exception occured. javax.jms.JMSException: Transaction
'TX:ID:vsplw04.edftrading.com-37462-1201088024192-1:0:211' has not been
started.
JMS Exception occured. javax.jms.JMSException: Transaction
'TX:ID:vsplw04.edftrading.com-37462-1201088024192-1:0:193' has not been
started.
JMS Exception occured. javax.jms.JMSException: Transaction
'TX:ID:vsplw04.edftrading.com-37462-1201088024192-1:0:203' has not been
started.

Is it ok to use transactions with failover? Is there a better way of doing
this?

Thanks,

Dave

-- 
View this message in context: 
http://www.nabble.com/Failover-and-Transactions-tp15040387s2354p15040387.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to