Amazon MQ (RabbitMQ) and Spring Boot AMQP Connection 12.2020
Dec 13, 2020
Had issues finding the autoconfig parameters for Amazon MQ that work with spring, most examples where outdated, I managed to connect eventually. Follow the instructions from Amazon to setup a Rabbit MQ Broker.
Your endpoint should be publicly accesible and you should get an endpoint adress starting with amqps
On the spring side add the dependency for amqp
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
on your application.properties file configure the connection using the url from the amazon console as follows
spring.rabbitmq.addresses=amqps://your-url:5671
spring.rabbitmq.username=dmeo
spring.rabbitmq.password=demo
You can now follow the examples you find online to send messages to the broker, this one worked well for me
https://github.com/thombergs/code-examples/tree/master/spring-boot/request-response