use of org.apache.activemq.artemis.jms.persistence.config.PersistedDestination in project activemq-artemis by apache.
the class JMSServerManagerImpl method initJournal.
/**
* @throws Exception
*/
private void initJournal() throws Exception {
this.coreConfig = server.getConfiguration();
createJournal();
storage.load();
List<PersistedConnectionFactory> cfs = storage.recoverConnectionFactories();
for (PersistedConnectionFactory cf : cfs) {
internalCreateCF(cf.getConfig());
}
List<PersistedDestination> destinations = storage.recoverDestinations();
for (PersistedDestination destination : destinations) {
if (destination.getType() == PersistedType.Queue) {
internalCreateQueue(destination.getName(), destination.getSelector(), destination.isDurable());
} else if (destination.getType() == PersistedType.Topic) {
internalCreateTopic(destination.getName());
}
}
}
use of org.apache.activemq.artemis.jms.persistence.config.PersistedDestination in project activemq-artemis by apache.
the class JMSStorageManagerTest method testJNDIPersistence.
// https://issues.jboss.org/browse/HORNETQ-812
@Test
public void testJNDIPersistence() throws Exception {
createJMSStorage();
jmsJournal.storeDestination(new PersistedDestination(PersistedType.Queue, "jndiPersistQueue", null, true));
jmsJournal.addBindings(PersistedType.Queue, "jndiPersistQueue", "jndi-1");
List<PersistedDestination> destinations = jmsJournal.recoverDestinations();
List<PersistedBindings> jndiList = jmsJournal.recoverPersistedBindings();
Assert.assertEquals(1, destinations.size());
Assert.assertEquals(1, jndiList.size());
jmsJournal.deleteDestination(PersistedType.Queue, "jndiPersistQueue");
destinations = jmsJournal.recoverDestinations();
Assert.assertEquals(0, destinations.size());
jmsJournal.stop();
createJMSStorage();
destinations = jmsJournal.recoverDestinations();
Assert.assertEquals(0, destinations.size());
jndiList = jmsJournal.recoverPersistedBindings();
Assert.assertEquals(1, jndiList.size());
PersistedBindings jndi = jndiList.get(0);
List<String> jndis = jndi.getBindings();
Assert.assertEquals(1, jndis.size());
Assert.assertEquals("jndi-1", jndis.get(0));
}
use of org.apache.activemq.artemis.jms.persistence.config.PersistedDestination in project activemq-artemis by apache.
the class JMSJournalStorageManagerImpl method load.
@Override
public void load() throws Exception {
mapFactories.clear();
List<RecordInfo> data = new ArrayList<>();
ArrayList<PreparedTransactionInfo> list = new ArrayList<>();
jmsJournal.load(data, list, null);
for (RecordInfo record : data) {
long id = record.id;
ActiveMQBuffer buffer = ActiveMQBuffers.wrappedBuffer(record.data);
byte rec = record.getUserRecordType();
if (rec == CF_RECORD) {
PersistedConnectionFactory cf = new PersistedConnectionFactory();
cf.decode(buffer);
cf.setId(id);
mapFactories.put(cf.getName(), cf);
} else if (rec == DESTINATION_RECORD) {
PersistedDestination destination = new PersistedDestination();
destination.decode(buffer);
destination.setId(id);
destinations.put(new Pair<>(destination.getType(), destination.getName()), destination);
} else if (rec == BINDING_RECORD) {
PersistedBindings bindings = new PersistedBindings();
bindings.decode(buffer);
bindings.setId(id);
Pair<PersistedType, String> key = new Pair<>(bindings.getType(), bindings.getName());
mapBindings.put(key, bindings);
} else {
throw new IllegalStateException("Invalid record type " + rec);
}
}
}
Aggregations