Package org.mule.util.journal.queue

Examples of org.mule.util.journal.queue.LocalTxQueueTransactionJournal


    @Test
    public void pollAndFailThenRecover() throws Exception
    {
        ((DefaultMuleConfiguration) muleContext.getConfiguration()).setWorkingDirectory(temporaryFolder.getRoot().getAbsolutePath());
        LocalTxQueueTransactionJournal txLog = new LocalTxQueueTransactionJournal(temporaryFolder.getRoot().getAbsolutePath(), muleContext);
        inQueue = new DefaultQueueStore(QUEUE_NAME, muleContext, new DefaultQueueConfiguration(0, true));
        PersistentQueueTransactionContext persistentTransactionContext = new PersistentQueueTransactionContext(txLog, createQueueProvider(inQueue));
        MuleEvent testEvent = getTestEvent(MESSAGE_CONTENT);
        inQueue.offer(testEvent, 0, 10);
        Serializable value = persistentTransactionContext.poll(inQueue, 100000);
        assertThat(inQueue.poll(10), IsNull.nullValue());
        assertThat(value, notNullValue());
        txLog.close();
        txLog = new LocalTxQueueTransactionJournal(temporaryFolder.getRoot().getAbsolutePath(), muleContext);
        LocalTxQueueTransactionRecoverer queueTransactionRecoverer = new LocalTxQueueTransactionRecoverer(txLog, createQueueProvider(inQueue));
        queueTransactionRecoverer.recover();
        Serializable muleEvent = inQueue.poll(10);
        assertThat(muleEvent, notNullValue());
        assertThat(testEvent.equals(muleEvent), is(true));
View Full Code Here


    @Test
    public void failBetweenLogEntryWriteAndRealPoolThenRecover() throws Exception
    {
        ((DefaultMuleConfiguration) muleContext.getConfiguration()).setWorkingDirectory(temporaryFolder.getRoot().getAbsolutePath());
        LocalTxQueueTransactionJournal txLog = new LocalTxQueueTransactionJournal(temporaryFolder.getRoot().getAbsolutePath(), muleContext);
        final DefaultQueueStore inQueue = new DefaultQueueStore(QUEUE_NAME, muleContext, new DefaultQueueConfiguration(0, true));
        PersistentQueueTransactionContext persistentTransactionContext = new PersistentQueueTransactionContext(txLog, createQueueProvider(inQueue));
        MuleEvent testEvent = getTestEvent(MESSAGE_CONTENT);
        inQueue.offer(testEvent, 0, 10);
        persistentTransactionContext.poll(inQueue, 10);
        txLog.close();
        txLog = new LocalTxQueueTransactionJournal(temporaryFolder.getRoot().getAbsolutePath(), muleContext);
        LocalTxQueueTransactionRecoverer queueTransactionRecoverer = new LocalTxQueueTransactionRecoverer(txLog, createQueueProvider(inQueue));
        queueTransactionRecoverer.recover();
        Serializable muleEvent = inQueue.poll(10);
        assertThat(muleEvent, notNullValue());
        assertThat(testEvent.equals(muleEvent), is(true));
View Full Code Here

    @Test
    public void offerAndFailThenRecover() throws Exception
    {
        ((DefaultMuleConfiguration) muleContext.getConfiguration()).setWorkingDirectory(temporaryFolder.getRoot().getAbsolutePath());
        LocalTxQueueTransactionJournal txLog = new LocalTxQueueTransactionJournal(temporaryFolder.getRoot().getAbsolutePath(), muleContext);
        final DefaultQueueStore outQueue = new DefaultQueueStore(QUEUE_NAME, muleContext, new DefaultQueueConfiguration(0, true));
        PersistentQueueTransactionContext persistentTransactionContext = new PersistentQueueTransactionContext(txLog, createQueueProvider(outQueue));
        MuleEvent testEvent = getTestEvent(MESSAGE_CONTENT);
        persistentTransactionContext.offer(outQueue, testEvent, 10);
        assertThat(outQueue.poll(10), IsNull.nullValue());
        txLog.close();
        txLog = new LocalTxQueueTransactionJournal(temporaryFolder.getRoot().getAbsolutePath(), muleContext);
        LocalTxQueueTransactionRecoverer queueTransactionRecoverer = new LocalTxQueueTransactionRecoverer(txLog, createQueueProvider(outQueue));
        queueTransactionRecoverer.recover();
        Serializable muleEvent = outQueue.poll(10);
        assertThat(muleEvent, nullValue());
    }
View Full Code Here

    @Override
    public void initialise() throws InitialisationException
    {
        String workingDirectory = getMuleContext().getConfiguration().getWorkingDirectory();
        localTxTransactionJournal = new LocalTxQueueTransactionJournal(workingDirectory + File.separator + "queue-tx-log", getMuleContext());
        localTxQueueTransactionRecoverer = new LocalTxQueueTransactionRecoverer(localTxTransactionJournal, this);
        xaTransactionJournal = new XaTxQueueTransactionJournal(workingDirectory + File.separator + "queue-xa-tx-log", getMuleContext());
        xaTransactionRecoverer = new XaTransactionRecoverer(xaTransactionJournal, this);
    }
View Full Code Here

TOP

Related Classes of org.mule.util.journal.queue.LocalTxQueueTransactionJournal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.