3

I downloaded Apache Artemis project from github. Artemis documentation mentions about settings to be done in the file "broker.xml". However, I could not locate the file. I looked into the location https://github.com/apache/activemq-artemis/tree/master/artemis-server/src/main/resources/schema and the file is not present. There are many broker.xml files in other projects.

Could someone please tell the location of the broker.xml file that needs to modified to run the Artemis broker? I intend to run via IDE. I am already able to run a single instance. Now I want to run a cluster for which I need to make changes to the broker.xml but I cannot locate where it is. Thanks.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
aries
  • 849
  • 3
  • 11
  • 24

3 Answers3

3

Before you can configure and run an Artemis instance you need to follow the installation steps to create an new Broker instance. Once you create your broker instance there will be a directory that houses all the configuration and command scripts needed to run the broker. The broker.xml is located in the ./etc/ folder along with some other configuration files that you can also tweak as needed.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42
1

By run via IDE you mean starting the broker instance in the Java code?

If you are starting up a single broker, just ensure that broker.xml is in your classpath. You can place the broker.xml into your resources directory and the broker will pick that up.

This obviously won't work if you want to run multiple broker instances with different configs. In that case, call broker.setConfigResourcePath and give each broker its own file.

import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
//...
broker = new EmbeddedJMS();
broker.setConfigResourcePath("broker_01.xml");
broker.start();

Sources:

The documentation for embedding Artemis was recently updated, git tip is available at https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/embedding-activemq.md.

There are two embedding* examples distributed with Artemis, you can view them at https://github.com/apache/activemq-artemis/tree/master/examples/features/standard.

user7610
  • 25,267
  • 15
  • 124
  • 150
0

I will take the example that I have put my uploaded package under /var/lib/ and I had extract it in the same path into "home_artemis". So, I will go under bin then run ./artemis with the right parameters:

broker name : Master_rep user login : admin ## used to connect after to hawtio console # user password : admin the broker path : /var/lib/home_artemis/bin/brokers/Master_rep/etc

By default, from the path that you will call the script artemis it will create there the broker : for example you are under

cd /var/lib

and you call

sudo /usr/local/bin/Artemis_home/bin/artemis create [broker_name]

your broker will be created under the path : /var/lib

For a best practice I advice to put all under the same path like this example :

cd /var/lib/home_artemis/bin

/artemis create brokers/Master_rep --name Master_rep --user admin --password admin --allow-anonymous /var/lib/home_artemis/bin/brokers/Master_rep/etc