Getting started with ActiveMQ Artemis

In this tutorial, we will cover the installation process, configuration options, and key concepts of ActiveMQ Artemis. We will walk you through the steps to set up a basic messaging system, demonstrate message publishing and consuming, explore advanced features, and share best practices along the way. Let’s dive into the world of ActiveMQ Artemis and unlock its potential for your messaging needs!

Installing Artemis MQ

Firstly, download ActiveMQ Artemis from: https://activemq.apache.org/components/artemis/download/

Then, unzip the bundle, then move into the bin folder and create an instance of the broker:

$ bin/artemis create myartemis --user admin --password admin --queues queueDemo --require-login

With this command, we have specified the credentials to login into the broker and a JMS Queue to be added into the configuration.

On the other hand, if you prefer starting ArtemisMQ as Container Image, check this article: How to run Artemis MQ as Docker Image

Starting the Broker

Next, you can start the broker. As you can see from the Console logs, you have two options:

You can now start the broker by executing:  

   "/home/francesco/jboss/apache-artemis-2.20.0/myartemis/bin/artemis" run

Or you can run the broker in the background using:

   "/home/francesco/jboss/apache-artemis-2.20.0/myartemis/bin/artemis-service" start

If you use the command artemis run, it will start the broker in foreground mode:

artemis mq broker tutorial

Let’s check that message exchange works correctly. We will be using the ‘artemis’ command to produce and consume messages:

$ myartemis/bin/artemis consumer --destination demoQueue --user admin --password admin

Then, from another shell execute:

$ myartemis/bin/artemis producer --destination demoQueue --user admin --password admin
Producer ActiveMQQueue[demoQueue], thread=0 Started to calculate elapsed time ...

Producer ActiveMQQueue[demoQueue], thread=0 Produced: 1000 messages
Producer ActiveMQQueue[demoQueue], thread=0 Elapsed time in second : 3 s
Producer ActiveMQQueue[demoQueue], thread=0 Elapsed time in milli second : 3770 milli seconds

Back to the consumer window, you will see that messages have been consumed:

Received 1000
Consumer ActiveMQQueue[demoQueue], thread=0 Consumed: 1000 messages
Consumer ActiveMQQueue[demoQueue], thread=0 Elapsed time in second : 32 s
Consumer ActiveMQQueue[demoQueue], thread=0 Elapsed time in milli second : 32620 milli seconds
Consumer ActiveMQQueue[demoQueue], thread=0 Consumed: 1000 messages
Consumer ActiveMQQueue[demoQueue], thread=0 Consumer thread finished

Viewing the ActiveMQ Artemis Console

The ArtemisMQ console is available at http://localhost:8161/console, and you can login with admin/admin and browse the management console. artemismq tutorial

Conclusion

Congratulations! You have successfully completed our comprehensive tutorial on getting started with ActiveMQ Artemis. We started by understanding the fundamentals of messaging systems and explored the key features and benefits of ActiveMQ Artemis. We covered the installation process, configuring connectors, creating destinations, and implementing basic message publishing and consuming.

Found the article helpful? if so please follow us on Socials