use of org.mule.runtime.core.internal.util.journal.queue.LocalTxQueueTransactionRecoverer in project mule by mulesoft.
the class LocalTxQueueTransactionRecovererTestCase method offerAndFailBetweenRealOfferAndCommitThenRecover.
@Test
public void offerAndFailBetweenRealOfferAndCommitThenRecover() throws Exception {
txLog = new TestTransactionLogger(temporaryFolder.getRoot().getAbsolutePath(), muleContext).failDuringLogCommit();
final DefaultQueueStore outQueue = new DefaultQueueStore(QUEUE_NAME, muleContext, new DefaultQueueConfiguration(0, true));
persistentTransactionContext = new PersistentQueueTransactionContext(txLog, createQueueProvider(outQueue));
persistentTransactionContext.offer(outQueue, testEvent(), TIMEOUT);
try {
persistentTransactionContext.doCommit();
fail();
} catch (ResourceManagerException e) {
// expected
}
txLog.close();
txLog = new TestTransactionLogger(temporaryFolder.getRoot().getAbsolutePath(), muleContext);
queueTransactionRecoverer = new LocalTxQueueTransactionRecoverer(txLog, createQueueProvider(outQueue));
queueTransactionRecoverer.recover();
Serializable muleEvent = outQueue.poll(TIMEOUT);
assertThat(muleEvent, nullValue());
}
use of org.mule.runtime.core.internal.util.journal.queue.LocalTxQueueTransactionRecoverer in project mule by mulesoft.
the class LocalTxQueueTransactionRecovererTestCase method doSetUp.
@Override
protected void doSetUp() throws Exception {
((DefaultMuleConfiguration) muleContext.getConfiguration()).setWorkingDirectory(temporaryFolder.getRoot().getAbsolutePath());
txLog = new LocalTxQueueTransactionJournal(temporaryFolder.getRoot().getAbsolutePath(), muleContext);
inQueue = new DefaultQueueStore(QUEUE_NAME, muleContext, new DefaultQueueConfiguration(0, true));
persistentTransactionContext = new PersistentQueueTransactionContext(txLog, createQueueProvider(inQueue));
queueTransactionRecoverer = new LocalTxQueueTransactionRecoverer(txLog, createQueueProvider(inQueue));
}
use of org.mule.runtime.core.internal.util.journal.queue.LocalTxQueueTransactionRecoverer in project mule by mulesoft.
the class LocalTxQueueTransactionRecovererTestCase method offerAndFailThenRecover.
@Test
public void offerAndFailThenRecover() throws Exception {
final DefaultQueueStore outQueue = new DefaultQueueStore(QUEUE_NAME, muleContext, new DefaultQueueConfiguration(0, true));
persistentTransactionContext = new PersistentQueueTransactionContext(txLog, createQueueProvider(outQueue));
persistentTransactionContext.offer(outQueue, testEvent(), TIMEOUT);
assertThat(outQueue.poll(TIMEOUT), nullValue());
txLog.close();
txLog = new LocalTxQueueTransactionJournal(temporaryFolder.getRoot().getAbsolutePath(), muleContext);
queueTransactionRecoverer = new LocalTxQueueTransactionRecoverer(txLog, createQueueProvider(outQueue));
queueTransactionRecoverer.recover();
Serializable muleEvent = outQueue.poll(TIMEOUT);
assertThat(muleEvent, nullValue());
}
use of org.mule.runtime.core.internal.util.journal.queue.LocalTxQueueTransactionRecoverer in project mule by mulesoft.
the class TransactionalQueueManager method initialise.
@Override
public void initialise() throws InitialisationException {
String workingDirectory = getMuleContext().getConfiguration().getWorkingDirectory();
int queueTransactionFilesSizeInMegabytes = getMuleContext().getConfiguration().getMaxQueueTransactionFilesSizeInMegabytes();
localTxTransactionJournal = new LocalTxQueueTransactionJournal(workingDirectory + File.separator + "queue-tx-log", getMuleContext(), queueTransactionFilesSizeInMegabytes);
localTxQueueTransactionRecoverer = new LocalTxQueueTransactionRecoverer(localTxTransactionJournal, this);
xaTransactionJournal = new XaTxQueueTransactionJournal(workingDirectory + File.separator + "queue-xa-tx-log", getMuleContext(), queueTransactionFilesSizeInMegabytes);
xaTransactionRecoverer = new XaTransactionRecoverer(xaTransactionJournal, this);
}
Aggregations