Search in sources :

Example 6 with JDBCPersistenceAdapter

use of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter in project activemq-artemis by apache.

the class RecoverExpiredMessagesTest method initCombosForTestRecovery.

public void initCombosForTestRecovery() throws Exception {
    addCombinationValues("queuePendingPolicy", new PendingQueueMessageStoragePolicy[] { new FilePendingQueueMessageStoragePolicy(), new VMPendingQueueMessageStoragePolicy() });
    PersistenceAdapter[] persistenceAdapters = new PersistenceAdapter[] { new KahaDBPersistenceAdapter(), new JDBCPersistenceAdapter(DataSourceServiceSupport.createDataSource(IOHelper.getDefaultDataDirectory()), new OpenWireFormat()) };
    for (PersistenceAdapter adapter : persistenceAdapters) {
        adapter.setDirectory(new File(IOHelper.getDefaultDataDirectory()));
    }
    addCombinationValues("persistenceAdapter", persistenceAdapters);
}
Also used : OpenWireFormat(org.apache.activemq.openwire.OpenWireFormat) JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) VMPendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy) FilePendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy) File(java.io.File) JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter) PersistenceAdapter(org.apache.activemq.store.PersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 7 with JDBCPersistenceAdapter

use of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter in project activemq-artemis by apache.

the class DurableSubscriptionReactivationTest method createBroker.

@Override
protected BrokerService createBroker() throws Exception {
    BrokerService answer = super.createBroker();
    answer.setKeepDurableSubsActive(keepDurableSubsActive);
    answer.setPersistenceAdapter(new JDBCPersistenceAdapter());
    answer.setDeleteAllMessagesOnStartup(true);
    return answer;
}
Also used : JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) BrokerService(org.apache.activemq.broker.BrokerService)

Example 8 with JDBCPersistenceAdapter

use of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter in project activemq-artemis by apache.

the class DurableSubscriptionOfflineTestListener method createBroker.

protected void createBroker(boolean deleteAllMessages) throws Exception {
    String currentTestName = getName(true);
    broker = BrokerFactory.createBroker("broker:(vm://" + currentTestName + ")");
    broker.setBrokerName(currentTestName);
    broker.setDeleteAllMessagesOnStartup(deleteAllMessages);
    broker.getManagementContext().setCreateConnector(false);
    broker.setAdvisorySupport(false);
    broker.setKeepDurableSubsActive(keepDurableSubsActive);
    broker.addConnector("tcp://0.0.0.0:0");
    if (usePrioritySupport) {
        PolicyEntry policy = new PolicyEntry();
        policy.setPrioritizedMessages(true);
        PolicyMap policyMap = new PolicyMap();
        policyMap.setDefaultEntry(policy);
        broker.setDestinationPolicy(policyMap);
    }
    setDefaultPersistenceAdapter(broker);
    if (broker.getPersistenceAdapter() instanceof JDBCPersistenceAdapter) {
        // ensure it kicks in during tests
        ((JDBCPersistenceAdapter) broker.getPersistenceAdapter()).setCleanupPeriod(2 * 1000);
    } else if (broker.getPersistenceAdapter() instanceof KahaDBPersistenceAdapter) {
        // have lots of journal files
        ((KahaDBPersistenceAdapter) broker.getPersistenceAdapter()).setJournalMaxFileLength(journalMaxFileLength);
    }
    broker.start();
    broker.waitUntilStarted();
}
Also used : JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 9 with JDBCPersistenceAdapter

use of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter in project activemq-artemis by apache.

the class DurableSubscriptionOfflineTestListener method setPersistenceAdapter.

public PersistenceAdapter setPersistenceAdapter(BrokerService broker, PersistenceAdapterChoice choice) throws IOException {
    PersistenceAdapter adapter = null;
    switch(choice) {
        case JDBC:
            LOG.debug(">>>> setPersistenceAdapter to JDBC ");
            adapter = new JDBCPersistenceAdapter();
            break;
        case KahaDB:
            LOG.debug(">>>> setPersistenceAdapter to KahaDB ");
            adapter = new KahaDBPersistenceAdapter();
            break;
        case LevelDB:
            LOG.debug(">>>> setPersistenceAdapter to LevelDB ");
            adapter = new LevelDBPersistenceAdapter();
            break;
        case MEM:
            LOG.debug(">>>> setPersistenceAdapter to MEM ");
            adapter = new MemoryPersistenceAdapter();
            break;
    }
    broker.setPersistenceAdapter(adapter);
    return adapter;
}
Also used : JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) MemoryPersistenceAdapter(org.apache.activemq.store.memory.MemoryPersistenceAdapter) LevelDBPersistenceAdapter(org.apache.activemq.store.leveldb.LevelDBPersistenceAdapter) MemoryPersistenceAdapter(org.apache.activemq.store.memory.MemoryPersistenceAdapter) LevelDBPersistenceAdapter(org.apache.activemq.store.leveldb.LevelDBPersistenceAdapter) JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter) PersistenceAdapter(org.apache.activemq.store.PersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 10 with JDBCPersistenceAdapter

use of org.apache.activemq.store.jdbc.JDBCPersistenceAdapter in project activemq-artemis by apache.

the class JDBCDurableSubscriptionTest method createPersistenceAdapter.

@Override
protected PersistenceAdapter createPersistenceAdapter() throws IOException {
    JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
    EmbeddedDataSource dataSource = new EmbeddedDataSource();
    dataSource.setDatabaseName("derbyDb");
    dataSource.setCreateDatabase("create");
    jdbc.setDataSource(dataSource);
    // set up small cleanup period
    jdbc.setCleanupPeriod(1000);
    return jdbc;
}
Also used : JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) EmbeddedDataSource(org.apache.derby.jdbc.EmbeddedDataSource)

Aggregations

JDBCPersistenceAdapter (org.apache.activemq.store.jdbc.JDBCPersistenceAdapter)20 BrokerService (org.apache.activemq.broker.BrokerService)10 PersistenceAdapter (org.apache.activemq.store.PersistenceAdapter)10 MemoryPersistenceAdapter (org.apache.activemq.store.memory.MemoryPersistenceAdapter)5 URI (java.net.URI)4 KahaDBPersistenceAdapter (org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)4 File (java.io.File)3 Properties (java.util.Properties)3 DataSource (javax.sql.DataSource)3 Connection (java.sql.Connection)2 DatabaseMetaData (java.sql.DatabaseMetaData)2 ResultSet (java.sql.ResultSet)2 PolicyEntry (org.apache.activemq.broker.region.policy.PolicyEntry)2 PolicyMap (org.apache.activemq.broker.region.policy.PolicyMap)2 LevelDBPersistenceAdapter (org.apache.activemq.store.leveldb.LevelDBPersistenceAdapter)2 EmbeddedDataSource (org.apache.derby.jdbc.EmbeddedDataSource)2 JDBCDataSource (org.hsqldb.jdbc.JDBCDataSource)2 Expectations (org.jmock.Expectations)2 Mockery (org.jmock.Mockery)2 Test (org.junit.Test)2