ActiveMQ Artemis Installation

Download address: https://activemq.apache.org/components/artemis/download/

For this example, download the package “apache-artemis-2.28.0-bin.zip” and unzip it to any installation directory.

Configure the environment variable “ARTEMIS_HOME”, the value is the unpacked directory.

Creating a Broker Instance

A Broker instance is a directory that contains all configuration and runtime data (such as logs and message logs) associated with the Broker process. It is recommended not to create the instance directory under ${ARTEMIS_HOME}.

For example, in this example, the specified Broker instance directory is “D:\data\activemq\artemis”.

Execute the following command in the specified Broker instance directory for installation.

1
2
cd /var/lib
${ARTEMIS_HOME}/bin/artemis create mybroker

The command on Windows is as follows.

1
2
3
cd D:\data\activemq\artemis
D:
%ARTEMIS_HOME%/bin/artemis create mybroker

where “mybroker” can be the name of a custom broker instance.

The full example is shown below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
C:\Users\wayla>cd D:\data\activemq\artemis

C:\Users\wayla>d:

D:\data\activemq\artemis>%ARTEMIS_HOME%/bin/artemis create mybroker
Creating ActiveMQ Artemis instance at: D:\data\activemq\artemis\mybroker

--user:
What is the default username?
admin

--password: is mandatory with this configuration:
What is the default password?


--allow-anonymous | --require-login:
Allow anonymous access?, valid values are Y, N, True, False
y

Auto tuning journal ...
done! Your system can make 0.4 writes per millisecond, your journal-buffer-timeout will be 2496000

You can now start the broker by executing:

   "D:\data\activemq\artemis\mybroker\bin\artemis" run

Or you can setup the broker as Windows service and run it in the background:

   "D:\data\activemq\artemis\mybroker\bin\artemis-service.exe" install
   "D:\data\activemq\artemis\mybroker\bin\artemis-service.exe" start

   To stop the windows service:
      "D:\data\activemq\artemis\mybroker\bin\artemis-service.exe" stop

   To uninstall the windows service
      "D:\data\activemq\artemis\mybroker\bin\artemis-service.exe" uninstall

The above installation process will require the user name and password, in this case, the user name “admin” and the password “123456”.

Starting and stopping the Broker instance

The installation directory of the Broker instance “mybroker” is “D:\data\activemq\artemis\mybroker”, and in the bin directory of this directory there is the executable file artemis.cmd.

Start the Broker instance

Start the Broker instance.

1
artemis run

After starting, you can see the console output as follows.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
D:\data\activemq\artemis\mybroker\bin>artemis run
     _        _               _
    / \  ____| |_  ___ __  __(_) _____
   / _ \|  _ \ __|/ _ \  \/  | |/  __/
  / ___ \ | \/ |_/  __/ |\/| | |\___ \
 /_/   \_\|   \__\____|_|  |_|_|/___ /
 Apache ActiveMQ Artemis 2.28.0


2023-02-14 09:32:38,354 INFO  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server version 2.28.0
2023-02-14 09:32:38,476 INFO  [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
2023-02-14 09:32:38,502 INFO  [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal
2023-02-14 09:32:38,544 INFO  [org.apache.activemq.artemis.core.server] AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 1073741824
2023-02-14 09:32:38,566 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
2023-02-14 09:32:38,566 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
2023-02-14 09:32:38,567 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
2023-02-14 09:32:38,567 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
2023-02-14 09:32:38,568 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
2023-02-14 09:32:38,568 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
2023-02-14 09:32:38,616 INFO  [org.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain live lock
2023-02-14 09:32:38,616 INFO  [org.apache.activemq.artemis.core.server] AMQ221035: Live Server Obtained live lock
2023-02-14 09:32:38,717 INFO  [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address DLQ supporting [ANYCAST]
2023-02-14 09:32:38,727 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
2023-02-14 09:32:38,765 INFO  [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
2023-02-14 09:32:38,767 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
2023-02-14 09:32:39,156 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started NIO Acceptor at 0.0.0.0:61616 for protocols [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
2023-02-14 09:32:39,186 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started NIO Acceptor at 0.0.0.0:5445 for protocols [HORNETQ,STOMP]
2023-02-14 09:32:39,213 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started NIO Acceptor at 0.0.0.0:5672 for protocols [AMQP]
2023-02-14 09:32:39,235 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started NIO Acceptor at 0.0.0.0:1883 for protocols [MQTT]
2023-02-14 09:32:39,258 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started NIO Acceptor at 0.0.0.0:61613 for protocols [STOMP]
2023-02-14 09:32:39,264 INFO  [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
2023-02-14 09:32:39,264 INFO  [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.28.0 [0.0.0.0, nodeID=774d5b12-ac07-11ed-8248-78af08fe9de0]
2023-02-14 09:32:39,270 INFO  [org.apache.activemq.artemis] AMQ241003: Starting embedded web server
2023-02-14 09:32:39,560 INFO  [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized activemq-branding plugin
2023-02-14 09:32:39,634 INFO  [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized artemis-plugin plugin
2023-02-14 09:32:40,781 INFO  [io.hawt.HawtioContextListener] Initialising hawtio services
2023-02-14 09:32:40,786 INFO  [io.hawt.system.ConfigManager] Configuration will be discovered via system properties
2023-02-14 09:32:40,788 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to Hawtio 2.15.0
2023-02-14 09:32:40,793 INFO  [io.hawt.web.auth.AuthenticationConfiguration] Starting hawtio authentication filter, JAAS realm: "activemq" authorized role(s): "amq" role principal classes: "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
2023-02-14 09:32:40,798 INFO  [io.hawt.web.auth.LoginRedirectFilter] Hawtio loginRedirectFilter is using 1800 sec. HttpSession timeout
2023-02-14 09:32:40,804 INFO  [io.hawt.web.proxy.ProxyServlet] Proxy servlet is disabled
2023-02-14 09:32:40,812 INFO  [io.hawt.web.servlets.JolokiaConfiguredAgentServlet] Jolokia overridden property: [key=policyLocation, value=file:/D:/data/activemq/artemis/mybroker/etc/\jolokia-access.xml]
2023-02-14 09:32:40,896 INFO  [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://localhost:8161
2023-02-14 09:32:40,897 INFO  [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://localhost:8161/console/jolokia
2023-02-14 09:32:40,897 INFO  [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://localhost:8161/console

Accessing the console interface of Artemis

The console interface of Artemis can be accessed via http://localhost:8161/.

Stop the Broker instance

Stops the Broker instance.

1
artemis stop

Sending and receiving messages

The ${ARTEMIS_HOME}\examples directory comes with a lot of usage examples, so you can select one of them to verify the sending and receiving of messages.

For example, if you select the example “examples\features\standard\queue”, you can run the example by executing the following command with the Broker instance started.

1
mvn -PnoServer verify

Or run the example by executing the following command without a Broker instance started.

1
mvn verify

After running, you can see the console output as follows.

1
2
3
4
5
6
7
8
[INFO] --- artemis-maven-plugin:2.28.0:cli (start) @ queue ---
[INFO]
[INFO] --- artemis-maven-plugin:2.28.0:runClient (runClient) @ queue ---
Sent message: This is a text message
Received message: This is a text message
[INFO]
[INFO] --- artemis-maven-plugin:2.28.0:cli (stop) @ queue ---
[INFO] ------------------------------------------------------------------------

You can see that the sample application has been able to send and receive the message “This is a text message” successfully.

Ref

  • hhttps://activemq.apache.org/components/artemis/documentation/