How to run Artemis Messaging in a Bootable Jar

This article is a walk-through the new embedded-activemq layer which allows to run the Artemis MQ Server in a WildFly Bootable Jar.

WildFly Bootable Jar allows to run Jakarta EE applications as runnable Jar applications, which include the required subsystems as Galleon layers. You can learn more about WildFly bootable Jar in this article: Turn your WildFly applications in bootable JARs

A Galleon layer includes one or more WildFly subsystems which provide a core functionality. The list of Galleon layers is available in the product documentation:

With the upcoming WildFly 27 release a new Galleon layer is available: embedded-activemq . By including this layer in the Bootable Jar you will be able to embed the Artemis MQ Broker in your Jar file.

Turning the MDB quickstart into a Bootable Jar

Firstly, we need an example which uses Message Driven Beans and a JMS producer. For this purpose we will use the HelloWorld MDB quickstart.

In order to enable the creation of WildFly bootable Jar, you need to include its plugin in your pom.xml. For example:


The most interesting aspect, is the embedded-activemq layer which allows to build the Embedded ActiveMQ broker. Besides, this layer will also provide additional configuration resources, e.g. socket-bindings. Necessary dependencies needed to support this use case, e.g. the resource-adapters subsystem, will also be provided.

Finally, include WildFly version as property:


Running the application

To build and run the application you can execute:

mvn clean package wildfly-jar:run

As you can see from the Server logs, WildFly starts. The ActiveMQ resource adapter deploys and so are the JMS Destinations which are in the example:

Then, reach the JMS Servlet available at: http://localhost:8080/HelloWorldMDBServletClient

As you can see, messages are dispatched to the MessageDriven Bean:


This article shows how to provide the a messaging-activemq subsystem in a WildFly Bootable Jar application. This quickstart defines programmaticaly JMS desitnations. if you want to add them via CLI in a Bootable Jar then check this article: How to execute CLI scripts in WildFly Bootable Jar

Special thanks to Jean-Francois Denise @RedHat for providing insights on the embedded-activemq layer