This project aims to validate AMQP protocol failover capability using a microservice architecture with Docker Compose, RabbitMQ, PostgreSQL and Springboot.
To validate failover capability, we will simulate a Product Purchase
(product checkout) flow at one e-commerce website. A purchase represents a click at buy button
Front-End that call some APIs representing Checkout flow, Payments Rules, Delivery Strategies, Reports and Notifications about product status.
To simulate a purchase scenarios, this project contains 4 apps running Jetty webservers and RabbitMQ clients:
- Checkout App: simulate a simple purchase process and notify event oriented architecture about it
- Delivery App: catch purchase event, and throw delivery process at distribution center
- Reports App: store info about purchase to generate business reports
- Notifications App: sent email to users about purchase status (bought, dispatched, delivered)
Requirements:
- Docker and Docker compose
- Java8 docker image
- PostegreSQL docker image
- RabbitMQ docker image
Technologies:
- Java8 and SpringBoot
- PostegreSQL for storage
- RabbitMQ for AMQP messaging
Use Docker Compose to run all apps and third dependencies. Compose file will up 4 apps, 1 PostgreSQL database and 1 cluster of Rabbitmq AMQP servers:
# Will run apps and third dependencies using Docker Compose
$ ./run-dev.sh
See at the bottom of this page the Architecture Diagram about communications with all parts of system.
Validate if everything is up running:
for i in {1..4};
do
curl -s "http://localhost:900$i/status"
done
# if it displays 4 lines with 'ok' text, it works
Fine! Lets test some schenarios
:
- All works fine:
- RabbitMQ slave die:
- RabbitMQ master die:
- Nothing works:
Some improvements, features or challenges to this project? Send me an e-mail or a comment.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Approvers will use the Contributing Guide to Approve
or Reject
all Pull Requests.
For backlog, bugs, questions and discussions please use the Issues.