Category: RabbitMQ

Spring Boot and RabbitMQ Direct Exchange Example : Messaging Custom Java Objects and Consumes with a Listener

As we are already aware, there are four types of RabbitMQ message exchanges are available.  They can be listed as follows.

  1. Direct Exachange
  2. Topic Exchange
  3. Fanout Exchange
  4. Header Exchange

 

In this article, i am expecting to demonstrate about how to use direct exchange in RabbitMQ with Spring Boot.  Before moving with the article it is required to have a up and running RabbitMQ server in your development environment.

If not please visit the https://www.rabbitmq.com/download.html  and installed the latest version in your development environment.

If you do not wish to install the RabbitMQ Server, you can use a Docker image. Purpose of this article is to demonstrate how the RabbitMQ message broker is effectively used within Spring Boot. I will be composing next article on how to use RabbitMQ Docker image in your development environment. So for the time being, lets move with the installed RabbitMQ server.

Ok. Lets move forward!

 

What is direct exchange?

In direct exchange, the messages are directly transmitted into the queue(s) who are having the same binding key as the routing key of the message. The binding key of the queue should exactly match the routing key of the message. All the queues that are bound to the direct exchange should have static binding keys (simply this means a constant text).  No wildcard binding keys are supported with direct exchange.

 

This is what we are going to do !

Screen Shot 2017-11-04 at 12.07.02 AM

 

Continue reading “Spring Boot and RabbitMQ Direct Exchange Example : Messaging Custom Java Objects and Consumes with a Listener”