activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From noone100 <mr.someb...@gmx.ch>
Subject Transactional Message Lost On Failover
Date Wed, 04 Mar 2015 14:03:36 GMT
Hi

In a transacted session I try to receive a message again after a failover
using the failover protocol (see code below). The fail on the broker is
triggered using a Byteman script, which kills the jvm right after the method
org.apache.activemq.transaction.LocalTransaction.commit(). After failover a
JMSException is thrown which is catched and handled by the consumer. The
problem is, that the message is not resent due to the fact that it is
already removed and committed from the broker's database. Is there any
solution for that problem?

public void onMessage(Message msg) {
  try {
    System.out.println("count: " + counter.incrementAndGet() + ", received
message " + msg.toString());
    session.commit(); // let amq broker jvm die
    System.out.println("after commit"); //  won't happen
  } catch (JMSException e1) {
    System.out.println("undo changes");
    try {
      session.rollback();
    } catch (JMSException e) {
      e.printStackTrace();
    }
  }
}

Thanks for your help!
Michael



--
View this message in context: http://activemq.2283324.n4.nabble.com/Transactional-Message-Lost-On-Failover-tp4692426.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message