In this quick tutorial we will learn how to configure WildFly 11 (or later) to use JMS JDBC Store against a RDBMS.

WildFly 11 JMS Broker, Apache ActiveMQ Artemis, ships with two persistence options:

  • The File journal which is highly optimized for the messaging use case and gives great performance
  • JDBC Store, which uses JDBC to connect to a database of your choice. The JDBC Store is still under development, but it is possible to use it's journal features, (essentially everything except for paging and large messages).

For our example, we will use MySQL as JDBC Store so let's start a Docker image of it to get started as quickly as possible:

$ sudo docker run -d --name mysql -e MYSQL_USER=mysql -e MYSQL_PASSWORD=mysql -e MYSQL_DATABASE=demodb -e MYSQL_ROOT_PASSWORD=secret mysql

Let's check the IP Address assigned to the MySQL container:

$ sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' mysql

Done with MySQL, let's define a datasource in WildFly to use that connection:

module add --name=com.mysql --resources=/tmp/mysql-connector-java-5.1.15.jar --dependencies=javax.api,javax.transaction.api


data-source add --jndi-name=java:/MySqlDS --name=MySQLPool --connection-url=jdbc:mysql:// --driver-name=mysql --user-name=root --password=secret



Now the only change needed to the messaging server is setting the journal-datasource attribute to use MySQL datasource Pool:

/subsystem=messaging-activemq/server=default:write-attribute(name=journal-datasource, value=MySQLPool)

Now let's try to deploy any of the JMS quickstarts such as:

Once executed the quickstart Servlet http://localhost:8080/helloworld-mdb/HelloWorldMDBServletClient?queue let's check if the messages are being written in the JDBC Storage:

docker exec -i -t mysql  /bin/bash

root@ca301fb894e2:/# mysql -u root -p                                                                                                                                          
Enter password: 

As you can see, messages are being written in the JDBC Storage:

mysql> select * from MESSAGES;
| id   | recordType | compactCount | txId | userRecordType | variableSize | record | txDataSize | txData | txCheckNoRecords | seq  |
|   -1 |         18 |            0 |   77 |             -1 |            0 |        |          0 |        |                0 |   24 |
1 row in set (0.00 sec)

Related articles available on

How to configure a Queue in JBoss ?

This article has been moved here: JBoss JMS configuration

How to create a Queue with Jmx Console ?

  Bring up the JMX Console in your browser and look for the sect

JBoss JMS Queue example

The following article shows how to create a simple JMS Queue Prod

JBoss JMS Topic example

The following article shows how to create a simple JMS Topic Publ

JBoss HornetQ simple tutorial

HornetQ is an open source project to build a multi-protocol, embe

How do I configure a Queue/Topic to work in a cluster?

  JBoss AS 5 Just set the Clustered attribute to "true" in your