Spring Boot RabbitMQ Example - Microservice for sending email using Spring Email and the Gmail SMTP server.
This repository contains a simple Microservice for sending email using Spring Email and the Gmail SMTP server. The aim of this repository is to practice and share how you can build a Microservice using Java Spring and RabbitMQ.
- Clone the repository:
$ git clone git@github.com:VidalGuilherme/spring-boot-rabbitmq-sample.git
- Install dependencies with Maven
- Run with docker-compose (docker-compose up -d)
- Start the application with Maven
- The API will be accessible at http://localhost:8080/
The project uses PostgresSQL as the database. Spring boot to automatically load my database schema when I start it up.
spring.jpa.generate-ddl=true
The project uses RabbitMQ as MQTT broker. Automatically load exchanges, queues and routingKey when I start it up.
default user: guest
default password: guest
The API provides the following endpoints:
POST /send-email
BODY
{
"ownerRef":"12345",
"emailFrom":"*****@gmail.com",
"emailTo":"*****@gmail.com",
"subject":"Subject",
"text":"Email Body"
}
POST /send-email/queue
BODY
{
"ownerRef":"12345",
"emailFrom":"*****@gmail.com",
"emailTo":"*****@gmail.com",
"subject":"Subject",
"text":"Email Body"
}
You can run a database for this project with Docker by running the following command:
$ docker-compose up -d
To install Docker locally you can click here.