mohsen-farahani / microservice-challange

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Microservice Challange

What's Problem ?

We have two separate services

Wallet and Discount

The Wallet Microservice is responsible for maintaining the user's financial information

and

Discount service The task of managing discount codes.

We want user be able to entering the code and charge his/her wallet.

How did I solve this problem?

I used Rest API to communicate at the same time and got help from message broker(RabbitMQ) where communication between microservices was needed.

But the way this connection was established had to be modeled on a distributed transaction Here I had two ways to do this process:

2pc or saga pattern

I preferred the saga method.

You can see my outline in the image below

Patterns for distributed transactions within a microservices architecture

Installation:

git clone https://github.com/mohsen-farahani/microservice-challange.git
docker-compose up -d

endpoint apis:

  • localhost:3000/campaigns/demand
  • localhost:3000/wallets/{mobile}
  • localhost:3000/users-campaigns

Refrences:

todo:

  • unit test

About


Languages

Language:PHP 94.1%Language:Dockerfile 3.1%Language:JavaScript 2.1%Language:Shell 0.8%