Updated: Apr 16
My interest in event-driven architecture has grown lately after reading a lot about its implementation in various places. I have come across apps that need this architectural style. In order to experiment, I created a simple architecture.
Architectural Flow Chart
I have come up with a very primitive architectural design based on the flow chart above. There are three moving parts:
UI Interfacing APIs - Push / Pull
Event Backbone - RabbitMQ / Kafka
Backend (System/Service Level) Interfacing APIs - Push / Pull
The idea is that both the UI and the App would be connected via APIs on either side of the backbone.
For example, assume that:
A user visits web app and starts registration.
User adds all necessary fields and click on register.
UI Push interfacing API will receive the user registration data, which pushes the data onto a queue / topic configured in RabbitMQ / Kafka with event NewUserRegistrationEvent
On the other side, Pull Interfacing API's, listens to certain events such as
Pull Interfacing API will save data via sending to backbone with DatabaseEvent.
An API listens to DatabaseEvent saves the app.
Database triggers on new save or update, which is listened by another API.
This API will push the data to either UIRenderEvent or ErrorEvent based on any error thrown by the database trigger.
If ErrorEvent is triggered, the data would be logged and any other error management can also be takes place. For this simple app, the error will be logged
If UIRenderEvent is triggered, then the Pull Interfacing API on the UI side will listen to the event and updates the UI using Web sockets (I am not familiar with one-way communication or any other method of updating the UI. I am unsure about this)
In essence, each action in the app will have its own event, which will have its own API. The Events are blueprints / interfaces that define the behavior, the APIs are implementations, and the Event backbone is the environment that drives the data.
Thank you for taking your time to look at the blog post. I'm currently building the above sample example and will place on GitHub