Event Driven Architecture

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:

  1. UI Interfacing APIs - Push / Pull

  2. Event Backbone - RabbitMQ / Kafka

  3. 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:

  1. A user visits web app and starts registration.

  2. User adds all necessary fields and click on register.

  3. 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

  4. On the other side, Pull Interfacing API's, listens to certain events such as

  5. NewUserRegistrationEvent

  6. DatabaseSaveEvent

  7. UIRenderEvent

  8. ErrorEvent

  9. Pull Interfacing API will save data via sending to backbone with DatabaseEvent.

  10. An API listens to DatabaseEvent saves the app.

  11. Database triggers on new save or update, which is listened by another API.

  12. This API will push the data to either UIRenderEvent or ErrorEvent based on any error thrown by the database trigger.

  13. 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

  14. 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

29 views0 comments