Package org.mule.util.queue.objectstore

Examples of org.mule.util.queue.objectstore.QueueKey


        // the key is built in way to prevent UntilSuccessful workers across a
        // cluster to compete for the same
        // events over a shared object store
        String key = muleEvent.getFlowConstruct() + "-" + muleEvent.getMuleContext().getClusterId() + "-"
                     + muleEvent.getId();
        return new QueueKey(QueuePersistenceObjectStore.DEFAULT_QUEUE_STORE, key);
    }
View Full Code Here


    }

    @Override
    protected Serializable createKey()
    {
        return new QueueKey("theQueue", UUID.getUUID());
    }
View Full Code Here

        createAndPopulateStoreFile(id, TEST_MESSAGE);

        List<Serializable> allKeys = store.allKeys();
        assertEquals(1, allKeys.size());

        QueueKey key = (QueueKey)allKeys.get(0);
        assertEquals(id, key.id);
    }
View Full Code Here

        QueuePersistenceObjectStore<Serializable> store = getObjectStore();

        String id = UUID.getUUID();
        createAndPopulateStoreFile(id, TEST_MESSAGE);

        QueueKey key = new QueueKey(QUEUE_NAME, id);
        Serializable value = store.retrieve(key);
        assertEquals(TEST_MESSAGE, value);
    }
View Full Code Here

        QueuePersistenceObjectStore<Serializable> store = getObjectStore();

        String id = UUID.getUUID();
        File storeFile = createAndPopulateStoreFile(id, TEST_MESSAGE);

        QueueKey key = new QueueKey(QUEUE_NAME, id);
        store.remove(key);

        assertFalse(storeFile.exists());
    }
View Full Code Here

    @Test
    public void testMonitoredWrapper() throws Exception
    {
        QueuePersistenceObjectStore<Serializable> store = getObjectStore();
        String id = UUID.getUUID();
        QueueKey key = new QueueKey(QUEUE_NAME, id);
        MuleMessage msg = new DefaultMuleMessage("Hello", mockMuleContext);
        MuleEvent event = new DefaultMuleEvent(msg, MessageExchangePattern.ONE_WAY, (FlowConstruct) null);

        ListableObjectStore<Serializable> monitored = new MonitoredObjectStoreWrapper(store);
        monitored.store(key, event);
View Full Code Here

                id = id.substring(beginIndex, length);

                String queue = id.substring(0, id.indexOf(File.separator));
                id = id.substring(queue.length() + 1);

                keys.add(new QueueKey(queue, id));
            }
        }
    }
View Full Code Here

        return deserialize(file);
    }

    protected File createStoreFile(Serializable key) throws ObjectStoreException
    {
        QueueKey queueKey = (QueueKey) key;

        String filename = queueKey.id + FILE_EXTENSION;
        String path = queueKey.queueName + File.separator + filename;

        try
View Full Code Here

    private void removeUnhealthyFiles() throws ObjectStoreException
    {
        List<Serializable> keys = allKeys();
        for (Serializable key : keys)
        {
            QueueKey qkey = (QueueKey) key;
            String fileName = storeDirectory + File.separator + qkey.queueName + File.separator + qkey.id
                              + FILE_EXTENSION;
            File file = new File(fileName);
            if (file.length() == 0)
            {
View Full Code Here

    }

    @Override
    public boolean contains(Serializable key) throws ObjectStoreException
    {
        return getStore().contains(new QueueKey(partitionName, key));
    }
View Full Code Here

TOP

Related Classes of org.mule.util.queue.objectstore.QueueKey

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.