How to use environment variables in Artemis MQ XML config?

Out of the box, you cannot directly embed environment variables into Artemis’s broker.xml configuration. You can, however, set System Properties in there, using the following syntax:

         <connector name="netty-connector">tcp://${amqHost}:${amqPort}</connector>

Then, you can inject the environment variable in the Java System property using the file artemis.profile which is located under the etc directory of your broker:


Therefore, you have to set the environment variable using your OS’ syntax. For example:

export AMQHOST=""
export AMQPORT=61617

That’s all. In this short article we have showed a quick hack to inject environment variables into ArtemisMQ configuration.