Reactive Messaging with AMQP and WildFly

In the second article of this series, we will learn how to code, configure and deploy a Reactive Application using WildFly and an AMQP Broker such as Artemis MQ. We will show step-by-step how to set up the environment with Docker and deploy an example application on WildFly.

MicroProfile Reactive Messaging with AMQP

WildFly supports, since version 31, the capability to run Reactive applications using a Connector the AMQP 1.0 protocol. As a proof of concept, we will deploy the same application tested with Apache Kafka (Writing Reactive Applications with WildFly ) with some minor configuration changes.


  • WildFly 31 or newer
  • Artemis MQ as standalone installation or an environment which supports Docker Compose

Setting up Artemis MQ

Firstly, we need to set up an AMQP Compatible Broker. As a matter of fact, Artemis MQ supports out of the box an AMQP Connector on Port 5672:

<acceptor name="amqp">tcp://;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpMinLargeMessageSize=102400;amqpDuplicateDetection=true</acceptor>

The simplest way to bootstrap a default Artemis MQ is to use the following docker-compose.yml which uses the default ports and admin/admin as credentials:

version: '2'

      - "5672:5672"
      - "61616:61616"
      - ./broker/broker.xml:/opt/amq/conf/broker.xml
      AMQ_USER: "admin"
      AMQ_PASSWORD: "admin"

More details about using Artemis MQ with Docker are available here: How to run Artemis MQ as Docker Image

Then, start the broker as follows:

docker-compose up

Finally, verify that the Broker is up and running:

artemis_1  | 2024-02-23 08:44:28,040 INFO  [org.apache.activemq.artemis] AMQ241001: HTTP Server started at
artemis_1  | 2024-02-23 08:44:28,041 INFO  [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at
artemis_1  | 2024-02-23 08:44:28,041 INFO  [org.apache.activemq.artemis] AMQ241004: Artemis Console available at

Setting up WildFly for Reactive Messaging

Next, we will move on the application server side. Since MicroProfile reactive Messaging is not a default extension available in the configuration we need to add it. From the CLI execute:



Configuring the Reactive Project

We will be using the same code base discussed in the first article of this series, which contains produces and consumes messages of type WeatherData:

wildfly messaging reactive amqp

We will apply the following changes to the project:

Firstly, modify the to include the Artemis MQ Settings. Also define the connector as smallrye-amqp Connector :



Then, as you can see from the configuration, we have renamed the channel names to “to-amq” and “from-amq“. Propagate the changes also in the RemoteMessaging Class:

public WeatherData producWeatherData(WeatherData message) {
        System.out.println("Sent WeatherData to Remote System : " + message);
        return message;

public CompletionStage<Void> consumeWeatherData(Message<WeatherData> message) {       
        System.out.println("Consumed WeatherData from Remote System: " + message.getPayload());
        return message.ack();

Finally, include the smallrye-reactive-messaging-amqp dependency in your project:


That’s all. You can now deploy the application on WildFly:

mvn install wildfly:deploy

You should be able to see the same output we have experimented with Apache Kafka:

16:28:57,546 INFO  [stdout] (pool-15-thread-1) Got Weather : WeatherData[city=Paris, temperature=19]
16:28:57,547 INFO  [stdout] (pool-15-thread-1) Sent WeatherData to Remote System : WeatherData[city=Paris, temperature=19]
16:28:57,553 INFO  [stdout] (vert.x-eventloop-thread-0) Consumed WeatherData from Remote System: {"city":"Paris","temperature":19}
16:28:59,549 INFO  [stdout] (pool-15-thread-1) Got Weather : WeatherData[city=London, temperature=11]
16:28:59,550 INFO  [stdout] (pool-15-thread-1) Sent WeatherData to Remote System : WeatherData[city=London, temperature=11]

Besides, you can also check the Artemis Web Console which is available at port 8161. Connect to it and verify the current Sessions/Producers/Consumers which are active on the queueDemo:

Make your application bootable with WildFly Glow

Turning our WildFly application into a Bootable JAR is a piece of cake since we can use WildFly Glow Project. All you need to provision a bootable JAR application is to execute the wildfly-glow script against our WAR file as follows:

./wildfly-glow scan /path/microprofile-reactive-messaging-amqp.war --provision=BOOTABLE_JAR

WildFly Glow will start scanning your package and produce a Bootable JAR file:

Wildfly Glow is scanning...
context: bare-metal
enabled profile: none
galleon discovery
- feature-packs
- layers

enabled add-ons
- amqp : Support for the MicroProfile Reactive Messaging AMQP connector.

Building WildFly Bootable JAR file...
Resolving feature-packs
Installing packages
Resolving artifacts
Generating configurations
Delayed generation, waiting...
Copy ./examples/microprofile-reactive-messaging-amqp.war to /tmp/wildfly-glow-bootable13267406566313063718/standalone/deployments/microprofile-reactive-messaging-amqp.war
Bootable JAR build DONE.
To run the jar call: 'java -jar microprofile-reactive-messaging-amqp-31.0.0.Final-bootable.jar'

Then, just run the application with the suggested command from the output:

java -jar microprofile-reactive-messaging-amqp-31.0.0.Final-bootable.jar

And you have got up and running your Messaging application as Bootable JAR!

10:32:27,460 INFO  [] (ServerService Thread Pool -- 24) WFLYSRV0010: Deployed "microprofile-reactive-messaging-amqp.war" (runtime-name : "microprofile-reactive-messaging-amqp.war")
10:32:27,491 INFO  [] (Controller Boot Thread) WFLYSRV0212: Resuming server
10:32:27,494 INFO  [] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on
10:32:27,494 INFO  [] (Controller Boot Thread) WFLYSRV0054: Admin console is not enabled
10:32:27,495 INFO  [] (Controller Boot Thread) WFLYSRV0025: WildFly Full 31.0.0.Final (WildFly Core 23.0.1.Final) started in 3153ms - Started 222 of 225 services (35 services are lazy, passive or on-demand) - Server configuration file in use: standalone.xml
10:32:27,593 INFO  [io.smallrye.reactive.messaging.amqp] (vert.x-eventloop-thread-0) SRMSG16213: Connection with AMQP broker established
10:32:27,611 INFO  [io.smallrye.reactive.messaging.amqp] (vert.x-eventloop-thread-0) SRMSG16213: Connection with AMQP broker established
10:32:27,621 INFO  [io.smallrye.reactive.messaging.amqp] (vert.x-eventloop-thread-0) SRMSG16203: AMQP Receiver listening address queueDemo
10:32:29,394 INFO  [stdout] (pool-11-thread-1) Got Weather : WeatherData[city=Paris, temperature=12]
10:32:29,402 INFO  [stdout] (pool-11-thread-1) Sent WeatherData to Remote System : WeatherData[city=Paris, temperature=12]

To learn more about WildFly Glow you can check this article: WildFly Glow: Next-Gen Evolution in Provisioning


This article covered how to configure a Reactive Application to produce and consume Messages through the AMQP Connector which is available in WildFly 31 or newer. Since the layer microprofile-reactive-messaging-amqp is also available in Galleon, we have built our application also as Bootable JAR.

Source code: