Search in sources :

Example 6 with DefaultQueueConfiguration

use of org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration 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());
}
Also used : Serializable(java.io.Serializable) DefaultQueueConfiguration(org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration) LocalTxQueueTransactionRecoverer(org.mule.runtime.core.internal.util.journal.queue.LocalTxQueueTransactionRecoverer) LocalTxQueueTransactionJournal(org.mule.runtime.core.internal.util.journal.queue.LocalTxQueueTransactionJournal) Test(org.junit.Test)

Example 7 with DefaultQueueConfiguration

use of org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration in project mule by mulesoft.

the class NoPersistenceTestCase method createQueueManager.

@Override
protected TransactionalQueueManager createQueueManager() throws Exception {
    TransactionalQueueManager mgr = new TransactionalQueueManager();
    mgr.setMuleContext(muleContext);
    mgr.initialise();
    mgr.setDefaultQueueConfiguration(new DefaultQueueConfiguration(0, false));
    return mgr;
}
Also used : DefaultQueueConfiguration(org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration)

Example 8 with DefaultQueueConfiguration

use of org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration in project mule by mulesoft.

the class TransactionalQueueManagerTestCase method allowChangingConfigurationOnDisposedQueue.

@Test
public void allowChangingConfigurationOnDisposedQueue() throws Exception {
    QueueManager queueManager = muleContext.getQueueManager();
    queueManager.setQueueConfiguration(TEST_QUEUE_NAME, new DefaultQueueConfiguration(0, true));
    QueueSession queueSession = queueManager.getQueueSession();
    Queue queue = queueSession.getQueue(TEST_QUEUE_NAME);
    queue.dispose();
    queueManager.setQueueConfiguration(TEST_QUEUE_NAME, new DefaultQueueConfiguration(0, false));
}
Also used : DefaultQueueConfiguration(org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration) Queue(org.mule.runtime.core.api.util.queue.Queue) QueueSession(org.mule.runtime.core.api.util.queue.QueueSession) QueueManager(org.mule.runtime.core.api.util.queue.QueueManager) Test(org.junit.Test)

Example 9 with DefaultQueueConfiguration

use of org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration in project mule by mulesoft.

the class TransactionalQueueManagerTestCase method createDanglingTx.

private void createDanglingTx() throws InterruptedException, MuleException {
    QueueManager queueManager = muleContext.getQueueManager();
    queueManager.setDefaultQueueConfiguration(new DefaultQueueConfiguration(0, true));
    QueueSession queueSession = queueManager.getQueueSession();
    queueSession.getQueue(TEST_QUEUE_NAME).put("value");
    queueSession.begin();
    queueSession.getQueue(TEST_QUEUE_NAME).poll(10);
    queueManager.stop();
}
Also used : DefaultQueueConfiguration(org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration) QueueSession(org.mule.runtime.core.api.util.queue.QueueSession) QueueManager(org.mule.runtime.core.api.util.queue.QueueManager)

Example 10 with DefaultQueueConfiguration

use of org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration in project mule by mulesoft.

the class TransactionalQueueManagerTestCase method clearRecoveryQueuesAfterRecovery.

@Test
public void clearRecoveryQueuesAfterRecovery() throws Exception {
    createDanglingTx();
    QueueManager queueManager = muleContext.getQueueManager();
    QueueSession queueSession = queueManager.getQueueSession();
    queueSession.getQueue(TEST_QUEUE_NAME).dispose();
    queueManager.setQueueConfiguration(TEST_QUEUE_NAME, new DefaultQueueConfiguration());
    queueManager.start();
}
Also used : DefaultQueueConfiguration(org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration) QueueSession(org.mule.runtime.core.api.util.queue.QueueSession) QueueManager(org.mule.runtime.core.api.util.queue.QueueManager) Test(org.junit.Test)

Aggregations

DefaultQueueConfiguration (org.mule.runtime.core.api.util.queue.DefaultQueueConfiguration)12 Test (org.junit.Test)6 QueueManager (org.mule.runtime.core.api.util.queue.QueueManager)5 QueueSession (org.mule.runtime.core.api.util.queue.QueueSession)5 Queue (org.mule.runtime.core.api.util.queue.Queue)3 LocalTxQueueTransactionRecoverer (org.mule.runtime.core.internal.util.journal.queue.LocalTxQueueTransactionRecoverer)3 Serializable (java.io.Serializable)2 Latch (org.mule.runtime.api.util.concurrent.Latch)2 LocalTxQueueTransactionJournal (org.mule.runtime.core.internal.util.journal.queue.LocalTxQueueTransactionJournal)2 AbstractQueueManager (org.mule.runtime.core.internal.util.queue.AbstractQueueManager)2 DefaultMuleConfiguration (org.mule.runtime.core.api.config.DefaultMuleConfiguration)1 MuleConfiguration (org.mule.runtime.core.api.config.MuleConfiguration)1 ResourceManagerException (org.mule.runtime.core.api.transaction.xa.ResourceManagerException)1 QueueConfiguration (org.mule.runtime.core.api.util.queue.QueueConfiguration)1 DefaultMuleContext (org.mule.runtime.core.internal.context.DefaultMuleContext)1