Keith, I think part of the issue I was having is that I wasn't defining
enough retry attempts in my connection url.  I've noticed the server side
failover usually takes up to 45 seconds and what I had set as options in the
connection url didn't cover that.

However, I am still having issues when utilizing session transactions.  I
stated earlier in this thread that session transactions were working
correctly for me.  That really wasn't accurate.  The issue I keep running
into is when I try a session commit (either after receiving or sending a
message) and a failover is in progress the session.commit() raises a
JMSException and I don't believe it should.  And what is really strange
about the session.commit() calls is that an exception is only raised when
the code does a try/catch around that session.commit() call.  If I don't do
a try/catch around that method call failover is successful and life is
great.  I know this makes no sense but I've been able to reproduce it
several times and have log files and my source code attached so you can
hopefully reproduce it.

My test code is here:
TestTxnExample.java
<http://qpid.2158936.n2.nabble.com/file/t396334/TestTxnExample.java>  .  It
has the try/catch around the session.commit() call and results in this
attached failure situation where the commit call throws an exception during
failover and the code stops processing.  qpid-session-cmt-error.log
<http://qpid.2158936.n2.nabble.com/file/t396334/qpid-session-cmt-error.log> 
.  I've actually added a sleep of 1 minute to the code when the JMSException
is thrown to try and give the qpid client code time to finish failover
processing and then I continue in the loop to send the next message.  When I
do that the previous message that the commit was called for was not
recovered by the qpid client and it is not persisted.  Also, I get a
different JMSExcepion that states a rollback needs to be done (or was done -
can't remember).

This log file is from a test I did of the same example code but I didn't
wrap the session.commit() call in a try/catch
qpid-session-cmt-success.log
<http://qpid.2158936.n2.nabble.com/file/t396334/qpid-session-cmt-success.log> 
.  You can see where failover was successful on the client and I validated
all messages were sent and persisted correctly in the broker.

I noticed that if I leave the try/catch around the session.commit() call but
add a sleep of 200 milliseconds after committing each message in the loop
failover is always successful and a JMSException is never raised when doing
a session.commit() call.  It almost seems like a threading/race condition
issue but that's just a complete guess.

Bryan





--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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

Reply via email to