A Bootique RabbitMQ Demo Application

If you look at the Bootique Module directory you'll notice that no demo for the Bootique RabbitMQ Module yet exists. To help the cause, here is the NixMash Bootique RabbitMQ Demo on GitHub. We'll cover the app in this post with special attention to the Bootique parts.

Demo In Action Mode

Before looking at the app let's jump ahead to see the messaging demo in action. First the Sender Module.

Here is the Receiver Module. Notice there is only a few millisecond difference between the time the message is sent and the time received.

App Structure

As I mentioned there is a Sender Module and Receiver Module. They share a Common Module as well.


Now we can see where Bootique comes into play. First the Maven root pom.xml where we add the RabbitMQ Client Module to our Bootique project.

Sending the Message

More Bootique Goodness for you here where in our SendUI Class we can inject both a ConnectionFactory and ChannelFactory for sending our RabbitMQ message.

We now use the factories to send our message like so:

Note: if you're using the Bootique ChannelFactory to open a RabbitMQ Channel there's an issue where both the Exchange and Queue must have the same name. Details in this NixMash Issue repo.

Configuring the RabbitMQ Connections, Exchanges and Queues

Here the Bootique.yml comes into play where we configure our RabbitMQ Connections, Exchanges and Queues.

Receiving the Message

We are using Bootique in our Receiver Module as well. First our Message Queue Handler…

…which we run in our Receiver Bootique Launcher.

Source Code Notes for this Post

Source code discussed in this post is found in my Bootique RabbitMQ Demo app on GitHub.