Skip to content

A study project on queue usage and management using Spring Integration and RabbitMQ

Notifications You must be signed in to change notification settings

100f/active-queue-manager-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Active Queue Manager Sample

A simple project for learning about Spring Integration and it's flows when used in a RabbitMQ environment.

📄 Overview

The project is built to integrate with a broker as follows:

A producer (created as project module) sends a message to a consumer (also a project module) through an intermediate queue called FilaValidador. As simple as is, the queue is bound to the producer through and exchange, which gets to know the target queue if the routing key NOVO_ARQUIVO_POSTADO is used in the process of sending the message.

Technologies used:

  • Spring Boot
  • Spring Integration
  • Docker
  • RabbitMQ

📀 Setup

To setup the project:

1. Make sure you have Maven installed in your machine.

2. Download this repository into a directory of your preference either by clicking on the download button in this repo or by cloning it using the GIT CLI:

$ git clone https://github.com/100f/active-queue-manager-sample.git

3. Set up detached Docker container for the RabbitMQ Management Server by executing compose command in the queue-server folder (don't forget to have Docker in your machine and to have Docker daemon up and running):

$ docker-compose up -d

4. Enter the RabbitMQ Management Server by accessing localhost:15672 and logging with the username admin, password 1234 and do the following:

  • Create a queue called FilaValidador with durable property set to true;
  • Create an exchange called validador.exchange with durable property set to true;
  • Enter in validador.exchange through server interface and add a binding to queue FilaValidador with NOVO_ARQUIVO_POSTADO as the routing key.

5. Install the dependencies of producer and consumer projects (modules) by executing mvn install inside each one.

6. Run the projects.

✉️ Sending a message

The producer runs at port 8088 and has message/notificar endpoint available. Just send a POST request using the query param rotulo with a label for the message (it's appended in message headers) and using a JSON body with mensagem field (message payload).

Example of request:

curl --request POST \
  --url 'http://localhost:8088/message/notificar?rotulo=TESTLABEL' \
  --header 'Content-Type: application/json' \
  --data '{
	"mensagem": "TEST MESSAGE PAYLOAD"
}'

Made by Caio Enrique - Aug, 2022. 👓

About

A study project on queue usage and management using Spring Integration and RabbitMQ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages