Sending and receiving JSON messages with Spring Boot AMQP and RabbitMQ

Setting up a Spring Boot application using AMQP with RabbitMQ is not really difficult, and there are many guides on the Internet showing you the basic setup. But creating an application making use of   @RabbitListener  annotations and producing and consuming messages in JSON format is trickier, so I would like to share with you a really simple but more serious approach that those hello-messaging apps.

This article covers:

  • How to send/publish Java Objects as JSON messages using Spring Boot and RabbitMQ   RabbitTemplate.
  • How to read/consume JSON messages to Java Objects using Spring Boot and RabbitMQ   @RabbitListener annotation.
  • How to send and receive Java Objects through RabbitMQ using default Java serializer.

Continue Reading