Integrating Spring Application and RabbitMQ

We have configured the spring-amqp dependencies in our project. Now, it is time to configure the RabbitMQ connections properly. We will use the RabbitMQTemplate to send messages to the broker; this has some converters which help us convert our domain models into JSON and vice versa.

Let's configure our RabbitMQ connections. The configurations should be in the application.yaml file and should look like this:

spring:  rabbitmq:    host: localhost    username: guest    password: guest    port: 5672

As we can see, some Spring configurations are quite similar to others, the same style, and the node in yaml is the name of the technology followed by a couple of attributes.

We are using the default credentials for the ...

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.