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-6388b67a3920b386124776-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? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like