mercredi 12 avril 2017

Microservice Architecture dependency

I have read a lot about microservice architecture but there is one thing that I dont understand how to achieve and hope you can help me with this...

Lets say I have a web-api-endpoint that recieves orders that an OrderMicroservice is responsible to handle. When order is put Inventory must be updated so OrderMS publish an event to subscribers (pub/sub using for example Nats) and InventoryMS will update the inventory due to it is subscribing to current event/message....I want to have a loose coupled architecture and use asynch calls to modules/MSs thats are interested in given info.

Given scenario will work perfectly fine if you have 1 instance of InventoryMS but what happens if you have scaled the InventoryMS horizontally i.e there are 5 instances of InventoryMS and all of them subscribes to inventory.change.event and will try to update the inventory?

What kind of architecture or message pattern should I use for a scenario like this with horizonatally scalled MS's so I can have a loose coupled architecture when MSs are dependent of each other? One way is that communication internally is made by REST-calls using circuit breaker pattern but then I feel that I build a monolite of MSs with some smartness (the circuit breaker)...

Thanks for your help!

Aucun commentaire:

Enregistrer un commentaire