Software Development, Spring

Spring Boot – Embedded ActiveMQ

This post demonstrates how to embed an ActiveMQ instance in Spring Boot and produce/consume messages with a simple example.

Spring Boot Application

You may still use the Spring Initialzr which is fine but we need to update the generated pom.xml to include additional dependencies.

Our [crayon-61a2d11152db4806207648-i/] class

We have two parts here – the embedded JMS server and client-stuff sections. @EnableJMS f is just an annotation that allows us to use @JmsListener (see MessageReceiver class).

Our Main class

In this class, we send a message to the JMS queue.

Sample Output

Download the Codes

https://github.com/Turreta/Spring-Boot-Embedded-JMS

 

Got comments, or suggestions? Please visit our Facebook page!

You Might Also Like