Default the ServerUrl in activemq-ra.rar to the embedded broker name

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Default the ServerUrl in activemq-ra.rar to the embedded broker name

Michael McKibben
I came across a need to change the embedded broker name created by the resource adapter using spring property substitution in the xbean configuration file. The problem with changing the embedded broker name to something configurable via property substitution is that the ServerUrl must also change from the hardcoded "tcp://localhost:61616" url to something like "vm://${brokerName}?create=false". Alas, values in ra.xml cannot be changed via property substitution. So, what I'd like to do is set the ServerUrl to null (empty) in the ra.xml, and have it be defaulted to "vm://brokerName?create=false" automagically from the broker name specified in the xbean configuration file.  For example:


... and also specify an xbean configuration file via the BrokerXmlConfig configuration property.


Then, inside my broker xml I can specify

<broker brokerName="${jboss.server.name}"> ...

I've created an Jira issue (https://issues.apache.org/activemq/browse/AMQ-2354) with an applied patch that implements this behavior if others find this feature useful and would like to see it included in a future release. Note, this behavior is only enabled if the default ra.xml is edited to remove the default value for ServerUrl *and* specify a valid BrokerXmlConfig location.