https://github.com/setxpro/message-brocker-rabbitmq
comunication with message brocker | Spring AMQP and RabbitMQ
https://github.com/setxpro/message-brocker-rabbitmq
amqp docker-compose hibernate java jpa maven microservice mysql rabbitmq spring-boot
Last synced: 3 months ago
JSON representation
comunication with message brocker | Spring AMQP and RabbitMQ
- Host: GitHub
- URL: https://github.com/setxpro/message-brocker-rabbitmq
- Owner: setxpro
- Created: 2024-03-16T02:06:37.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-16T02:57:58.000Z (over 2 years ago)
- Last Synced: 2025-08-02T04:55:58.105Z (11 months ago)
- Topics: amqp, docker-compose, hibernate, java, jpa, maven, microservice, mysql, rabbitmq, spring-boot
- Language: Java
- Homepage:
- Size: 68.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring AMQP and RabbitMQ







Peer-to-peer messaging: This is the distribution pattern used in message queues with a one-to-one relationship between the sender and recipient of the message. Each message in the queue is sent to only one recipient and is used only once. Peer-to-peer messaging is called when a message is to be acted upon only once. Examples of suitable use cases for this style of messaging include payroll and financial transaction processing. In these systems, both senders and recipients need a guarantee that each payment will be sent once and only once.
## Table of Contents
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [API Endpoints](#api-endpoints)
- [Database](#database)
- [Author](#author)
## Installation
1. Clone the repository:
```bash
git clone https://github.com/setxpro/message-brocker-rabbitmq.git
```
2. Install dependencies with Maven
3. Run docker-compose up to create database and rabbitmq image
## Configuration
1. Create a configuration in `application.yml`
```yaml
server:
- port: 8080
spring:
datasource:
username: root
url: jdbc:mysql://localhost:3306/orders?createDatabaseIfNotExists=true&serverTimezone=UTC&useSSL=false
password: ''
jpa:
show-sql: 'true'
hibernate:
ddl-auto: 'update'
rabbitmq:
host: localhost
port: 5672
username: rabbitmq
password: rabbitmq
```
2. Create a configuration in `pom.xml`
```xml
org.springframework.boot
spring-boot-starter-data-jpa
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-devtools
runtime
true
com.mysql
mysql-connector-j
runtime
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-starter-amqp
```
3. Create a job with docker in `docker-compose.yml`
```yml
services:
mysql-8:
image: mysql:8.0.18
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_ROOT_PASSWORD: ""
MYSQL_DATABASE: "orders"
ports:
- "3306:3306"
```
## Usage
After your realized all configurations
1. Start the application with Maven
2. Start docker containers Rabbitmq and mysql
## API Endpoints
The API provides the following endpoints:
Endpoints
[order-service] - http://localhost:8080/v1/order
```json
{
"id": 16,
"value": 2500,
"paid": false
}
```
## RabbitMQ
Endpoints
[PAINEL] - http://localhost:15672/
[CONNECTION] - http://localhost:5672/
Queue
[notification-service] - orders.v1.order-created.send-notification
[cashback-service] - orders.v1.order-created.generate-cashback
## DATABASE
Mysql - created with Docker
## Author
👤 **Patrick Anjos**