Skip to content

Commit

Permalink
Explicitly specifying a data folder for ActiveMQ, just in case the
Browse files Browse the repository at this point in the history
default is where we do not have permissions for: Include ongoing
Registration App work in Reference Application - RA-45
  • Loading branch information
dkayiwa committed May 15, 2013
1 parent 5edcd16 commit 31cb211
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/src/main/java/org/openmrs/event/EventEngine.java
Expand Up @@ -34,6 +34,7 @@
import org.apache.commons.logging.LogFactory;
import org.openmrs.OpenmrsObject;
import org.openmrs.api.APIException;
import org.openmrs.util.OpenmrsUtil;
import org.springframework.jms.connection.SingleConnectionFactory;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
Expand Down Expand Up @@ -115,7 +116,9 @@ public Message createMessage(Session session) throws JMSException {
private synchronized void initializeIfNeeded() {
if (jmsTemplate == null) {
log.info("creating connection factory");
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=true");
String dataDirectory = OpenmrsUtil.getApplicationDataDirectory() + "activemq-data";
String brokerURL = "vm://localhost?broker.persistent=true&broker.dataDirectory=" + dataDirectory;
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(brokerURL);
connectionFactory = new SingleConnectionFactory(cf); // or CachingConnectionFactory ?
jmsTemplate = new JmsTemplate(connectionFactory);
} else {
Expand Down

0 comments on commit 31cb211

Please sign in to comment.