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.

POM.xml

Now we can seeing 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.

稿源:NixMash (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » A Bootique RabbitMQ Demo Application

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录