Start RabbitMQ
docker-compose up
Run App
mvn spring-boot:run
Test
curl --location --request POST 'http://localhost:8000/api/v1/publish' \
--header 'Content-Type: application/json' \
--data-raw '{
"fullName":"Cosmas Lorem",
"phone":"25412345678",
"email":"[email protected]"
}'
Response
{"code":200,"message":"Message Published"}
stdout
NotificationRequest(fullName=Cosmas Lorem, phone=25412345678, [email protected])
------------------------
Publishing to internal.exchange using routingKey internal.notification.routing-key. Payload: NotificationRequest(fullName=Cosmas Lorem, phone=25412345678, [email protected])
------------------------
------------------------
Published to internal.exchange using routingKey internal.notification.routing-key. Payload: NotificationRequest(fullName=Cosmas Lorem, phone=25412345678, [email protected])
------------------------
------------------------
Consumed message from queue
NotificationRequest(fullName=Cosmas Lorem, phone=25412345678, [email protected])
------------------------
Inspect at Rabbit Management UI Dashboard - http://localhost:15672/
For further reference, please consider the following sections:
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Create an OCI image
- Spring for RabbitMQ
- Spring Web
The following guides illustrate how to use some features concretely: