allow for transaction rolledback exception: https://issues.apache.org/activemq/browse/AMQ-2590

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@906697 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-02-04 22:33:33 +00:00
parent b88edf25d9
commit e561040c70
1 changed files with 7 additions and 1 deletions

View File

@ -31,6 +31,7 @@ import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.TransactionRolledBackException;
import junit.framework.TestCase;
@ -172,10 +173,11 @@ public class AMQ2149Test extends TestCase {
return nextExpectedSeqNum;
}
final int TRANSACITON_BATCH = 500;
public void onMessage(Message message) {
try {
final long seqNum = message.getLongProperty(SEQ_NUM_PROPERTY);
if ((seqNum % 500) == 0) {
if ((seqNum % TRANSACITON_BATCH) == 0) {
LOG.info(dest + " received " + seqNum);
if (transactional) {
@ -195,6 +197,10 @@ public class AMQ2149Test extends TestCase {
}
++nextExpectedSeqNum;
lastId = message.getJMSMessageID();
} catch (TransactionRolledBackException expectedSometimesOnFailoverRecovery) {
LOG.info("got rollback: " + expectedSometimesOnFailoverRecovery);
// batch will be replayed
nextExpectedSeqNum -= (TRANSACITON_BATCH -1);
} catch (Throwable e) {
LOG.error(dest + " onMessage error", e);
exceptions.add(e);