During the last couple of months, I wrote a lot blog posts about ActiveMQ (JMS), AngularJS and Spring. Most of those blog posts include some small code snippets, but nothing more. That’s why I decided to setup a “boilerplate project” to show how all those different techniques can go hand in hand in a “real life example”.
You can find the boilerplate project on GitHub:
The project contains three small microservices plus an user interface (which is somehow just another microservice). All backend stuff is written in Java (using Spring Boot), the frontend is written in AngularJS (version 1.6.X). The three microservices communicate with each other via JMS messages (send over ActiveMQ). The UI uses a Zuul proxy in order to use the REST APIs of the three different microservices. Everything is setup with Gradle (for the backend) and Grunt (for the frontend).
The boilerplate project is based on a fictitious example:
- An user can submit a review about a product
- A review consists of a subject, the actual content and a rating (0 to 5)
- Each review is checked if it contains inappropriate language (such as words like “shit” or “bad”)
- Based on that, a review will either be approved or rejected
- Every approved review can be seen in a list
The project consists of three microservices plus the UI:
- Review system
- Checking system
- Statistics system
- User interface
The review system takes and persists new reviews. It also holds the state of each review (approved or rejected) and allows to query all approved reviews.
The checking system will examine the content of each application. It will reject reviews containing inappropriate language (such as the words “shit” or “bad”).
The statistics system will keep track of a simple statistic on how many reviews have been submitted, approved and rejected.
The user interface allows to submit new reviews and to see all approved reviews. It also displays the current overall statistics.
The communication between the UI and the backend services is based on REST. A Zuul proxy is used to route the UI requests to the different microservices.
On the other hand, the communication between the microservices is based on JMS using ActiveMQ. Three different types of events are being exchanged (
REVIEW_REJECTED_EVENT) between the system. Note that all events are send to a topic – not directly to a service queue (as described here)!
This boilerplate project tries to reflect my thoughts on a simple architecture and design. I’ve tried to combine different aspects (such as backend, frontend, testing, messaging, etc.) of a typical application, hoping to present my ideas in a more realistic way.
- An interesting view on boilerplate projects: The best boilerplate app is the one you code yourself