Follow us

Microservices Event Driven Architecture

Hi,

Last week, I had spent some time on doing some POC on microservic event driven architect and today I thout lets put it as article.

Microservices Event Driven Architecture, where I have used AWS SNS and SQS for ESB(message bus) as publisher and subscriber to publish and listen the even and get microservice executed and rollback as per event status.

Architecture Diagram-

Architecture Diagram Workflow-

  1. Client request for the enrollment directly via Enrollment endpoint exposed with API Gateway.
  2. Or Client request Front End UI(Enrollment Form) and on Form submit request send to API Gateway for enrollment.
  3. API Gateway route request to Customer.API microservice for enrollment.
  4. Customer.API do the enrollment and enrollment data store into Customer DB.
  5. Customer.API publish message to ESB about enrollment status with relevant attributes values to reward enrollment bonus points(transaction).
  6. API Gateway as subscriber(Transaction Endpoint) receive message/notification from ESB.
  7. API Gateway route request to Transaction.API microservice to post bonus points(transaction).
  8. Transaction.API read message from ESB to process the message and post bonus points(transaction).
  9. Transaction.API store transaction data into Transaction DB.
  10. Transaction.API publish message to ESB about transaction status. Here in case transaction fail then it publish fail message/notification to ESB and then again the rollback activity get started reference to earlier activity of enrollment (Customer.API - reference to above point no. 4). If rollback received then below flow will execute.
  11. API Gateway as subscriber(Customer Endpoint) receive message/notification from ESB.
  12. API Gateway route request to Customer.API microservice for UnEnrollment.
  13. Customer.API read message from ESB to process UnEnrollment.
  14. Customer.API store/modify enrollment data into Customer DB.

Technologies Used for Development -

  1. Visual Studio 2019 with .Net Core 3.1 : AS IDE and Framework for developing Microservice.
  2. Ocelot : For API Gateway.
  3. SQL Server 2018 : For backend database per Microservices.
  4. AWS SNS/SQS : For ESB message publish and subscribe.
  5. AWS EC2 : For hosting all the Microservices including API Gateway.

Code Base Architecture- 

 

Customer.API Microservice Architecture/Code-Base Understanding-

 

Transaction.API Microservice Architecture/Code-Base Understanding-

 

WebApp.APIGateway Architecture/Code-Base Understanding-

 

Utility Code-Base Understanding-

 

I will also share complete code base sample very soon.

Categories/Tags: microservice~event driven architect

Recent Articles

1

AWS Saving Plan - Cost optimization tips

2
3

AWS RDS Key Concepts & Why you should use it?

4
5

Open-Search/Kibana - Multi Tenancy Setup

See All Articles