8

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

0

Mapping REST API to Plain Java Objects (POJOs)

Let’s say you want to connect your web/application with a third party REST API. Within this article I’ll put as example the SonarQube API, given that is the one I’ve used in my last personal project (see post).

In this post I’ll describe how I solved the situation of having no schema for the data that you’re retrieving from the REST API. How can we map this structure to Java Objects?

Continue Reading