Skip to content

PoC to understand how to send and receive messages with Spring Boot and ActiveMQ

Notifications You must be signed in to change notification settings

arthuRHD/spring-boot-activemq

Repository files navigation

spring-boot-activemq

Tools needed

You need Docker with the compose plugin.

Usage

Launch the ActiveMQ and the spring boot app with docker

docker compose up --build -d

Then you can try with these endpoints :

sequenceDiagram
    Backend->>+ActiveMQ: Subscribe to 'messageQueue'
    Backend->>+ActiveMQ: Publish 'hi everyone !' to 'messageQueue'
    ActiveMQ->>+ActiveMQ: Put the message and make it available to consumers
    ActiveMQ->>+Backend: Broadcast the availability to consumers 
    Backend->>+ActiveMQ: Consume the message
    Backend->>+Backend: Delete the message to remove availability
    Backend->>+Backend: Print the message in the standard output
Loading

You can display the standard output of the backend with

docker logs spring-app-1 -f

In this application, I've used the default configuration for the JMS Listener. In production, we should tune the timeouts and most of all, the consumption acknowledgment mode (CLIENT or AUTO) of the session.

About

PoC to understand how to send and receive messages with Spring Boot and ActiveMQ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages