Skip to content

DanielMichalski/spring-boot-rabbitmq-integration

Repository files navigation

Spring Boot RabbitM Integration

Build Status License: MIT

This project aims to present how to create and configure a Spring Boot + RabbitMQ application. The project is built using Java, Spring Boot, RabbitMQ and Docker.

Table of Contents

Prerequisites

Libraries

Library name Description
Spring Boot 2 Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run".
RabbitMQ RabbitMQ is the most widely deployed open source message broker.
Docker Compose Compose is a tool for defining and running multi-container Docker applications.

Running the application

On Windows

## Run RabbitMQ on Docker
docker-compose up -d

## Build and run publisher application using Maven Wrapper
mvnw.cmd -f rabbitmq-publisher/pom.xml clean install spring-boot:run

## Build and run receiver application using Maven Wrapper
mvnw.cmd -f rabbitmq-receiver/pom.xml clean install spring-boot:run

On MacOS/ Linux

## Run RabbitMQ on Docker
docker-compose up -d

## Build and run publisher application using Maven Wrapper
./mvnw -f rabbitmq-publisher/pom.xml clean install spring-boot:run

## Build and run receiver application using Maven Wrapper
./mvnw -f rabbitmq-receiver/pom.xml clean install spring-boot:run

RabbitMQ access

RabbitMQ URL Username Password
http://localhost:15672 admin admin

Sending message

In order to send a message to the queue please send a request:

curl --header "Content-Type: application/json" --request POST --data "{\"firstName\":\"John\",\"lastName\":\"Black\"}" http://localhost:8080/api/messages

Screens

Screen 1

Screen 2

Screen 3

Screen 4