Skip to content

Commit

Permalink
broker check before start
Browse files Browse the repository at this point in the history
  • Loading branch information
delchev committed Feb 4, 2024
1 parent 2ab4e50 commit 4138d64
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,21 @@ ActiveMQConnectionFactory createActiveMQConnectionFactory() {
BrokerService createBrokerService(@Qualifier("SystemDB") DataSource dataSource) {
try {
BrokerService broker = new BrokerService();
if (Boolean.parseBoolean(
org.eclipse.dirigible.commons.config.Configuration.get("DIRIGIBLE_MESSAGING_USE_DEFAULT_DATABASE", "true"))) {
PersistenceAdapter persistenceAdapter = new JDBCPersistenceAdapter(dataSource, new OpenWireFormat());
broker.setPersistenceAdapter(persistenceAdapter);
}
broker.setPersistent(true);
broker.setUseJmx(false);
PListStore pListStore = new PListStoreImpl();
pListStore.setDirectory(new File(LOCATION_TEMP_STORE));
broker.setTempDataStore(pListStore);
broker.addConnector(CONNECTOR_URL);
if (!broker.isStarted()) {
if (Boolean.parseBoolean(
org.eclipse.dirigible.commons.config.Configuration.get("DIRIGIBLE_MESSAGING_USE_DEFAULT_DATABASE", "true"))) {
PersistenceAdapter persistenceAdapter = new JDBCPersistenceAdapter(dataSource, new OpenWireFormat());
broker.setPersistenceAdapter(persistenceAdapter);
}
broker.setPersistent(true);
broker.setUseJmx(false);
PListStore pListStore = new PListStoreImpl();
pListStore.setDirectory(new File(LOCATION_TEMP_STORE));
broker.setTempDataStore(pListStore);
broker.addConnector(CONNECTOR_URL);

broker.start();
broker.start();
}

return broker;
} catch (Exception ex) {
Expand Down

0 comments on commit 4138d64

Please sign in to comment.