AMQ-2354: JCA adapter. Default the ServerUrl to vm://brokerName?create=false when an embedded broker is specified with brokerXmlConfig. Thanks to Michael McKibben for the patch.

This commit is contained in:
Claus Ibsen 2014-04-01 10:16:18 +02:00
parent 997bbb7a01
commit 1999ddfd01
1 changed files with 4 additions and 0 deletions

View File

@ -85,6 +85,10 @@ public class ActiveMQResourceAdapter extends ActiveMQConnectionSupport implement
broker = BrokerFactory.createBroker(new URI(brokerXmlConfig)); broker = BrokerFactory.createBroker(new URI(brokerXmlConfig));
} }
broker.start(); broker.start();
// Default the ServerUrl to the local broker if not specified in the ra.xml
if (getServerUrl() == null) {
setServerUrl("vm://" + broker.getBrokerName() + "?create=false");
}
} catch (Throwable e) { } catch (Throwable e) {
log.warn("Could not start up embeded ActiveMQ Broker '"+brokerXmlConfig+"': "+e.getMessage()); log.warn("Could not start up embeded ActiveMQ Broker '"+brokerXmlConfig+"': "+e.getMessage());
log.debug("Reason for: "+e.getMessage(), e); log.debug("Reason for: "+e.getMessage(), e);