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);
}
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;
}
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();
}
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;
}
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;
}
Aggregations