Spring AMQP / RabbitMQ Topic Exchange Example Part 3 – Consumer Application (Automatically receiving messages with Listener)

In this article, we will be developing a RabbitMQ Consumer application for the Publisher application developed at previous article (named as part 1).

Click here to view the Publisher Application related to this article.

We have already developed a consumer application to consume the messages published by the above consumer application. In that consumer application we have focused on retrieving the publish messages manually. In other words, pulling the messages from the RabbitMQ queue whenever the client application needs them.  If you need to look at that article, please click here. 

In this article, we will be focusing on receiving the messages from queues with a listener.  The consumer application will be listening for one or more queues for the incoming messages. whenever an incoming message is delivered to one of those queues, that message will be delivered to the consumer application through the listener (available in the consumer application).

This application is very much similar to the Consumer application we have developed or part 2 of this article series. Therefore all the configuration related classes will be same and i am not going to repeatedly explain them here. If you want know the further details, please refer the explanations in those articles.

The full source code of this application can be found at GitHub.

Click here to download the source code. 

Open the source code directory called consumer-listener. In there you can see the source codes related to this article.

I will explain the most critical component here. That is the ConsumerService.

ConsumerService will be listening to two queues known as all_cars_queue” and nissan_cars_queue“. whenever a message is delivered to any of those queues, that message will be delivered to this consumer service class. 

 

 

 

2 thoughts on “Spring AMQP / RabbitMQ Topic Exchange Example Part 3 – Consumer Application (Automatically receiving messages with Listener)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s