Problem
How to use JMS in a Spring Boot application and how to connect to the JMS broker.
Solution
Spring Boot supports auto-configuration for ActiveMQ and Artemis. Adding one of those JMS Providers together with setting some properties in, respectively, the spring.activemq
and spring.artemis
namespace is everything needed.
Problem
How to send messaes to other systems over JMS.
Solution
Use the Spring Boot-provided JmsTemplate
to send and (optionally) convert messages.
Problem
How to read messages from a JMS destination so that you can handle them in a Spring Boot application.
Solution
Create a class and annotate methods with @JmsListener
to bind it to a destination and handle incoming messages.
Problem How to use AMQP messaging in a Spring Boot application and need to connect to the RabbitMQ broker.
Solution
Configure the appropriate spring.rabbitmq
properties (minimal spring.rabbitmq.host
) to connect to the exchange and be able to send and receive messages.
Problem
How to send a message to a RabbitMQ broker so that the message can be delivered to the receiver.
Solution
Using the RabbitTemplate
, messages can be sent to an exchange and provide a routing key.
Problem
How to receive messages from a RabbitMQ.
Solution
Annotating a method with @RabbitListener
will bind it to a queue and let it receive messages.