Distributed .NET Core - Episode 4 [Asynchronous microservices integration via events]


#1

In the fourth episode, we make use of the events (being sent to the message bus) in order apply asynchronous integration between microservices. Such technique removes temporal coupling and increases resiliency.


#2

One question
How to deal with this situation

Two Services
Customer
Orders

When we create the customer at the same time we create a copy of the customer in ORDERS
because we subscribe to the EVENT create customer

We have to do something with ORDERS and but in the meantime, the new customer is added - how to synchronize the customers in ORDERS with the customers in CUSTOMERS service?
somehow on startup?

thank you for the answer


#3

Correct me if I’m wrong. When you create customer in customer service it means that she/he does not have any order created before. Validation should not pass in that case while creating an order. So why do you need such customer data this time in orders service?


#4

Hi guys thank you for a great episode! I had one question from watching this video.

What happens if your discount services is offline when a new customer is created? Currently I believe that would mean that a customer would not be added to discounts internal customer table. Therefore, even though this customer actually exists, based on the current validation a request to create a discount would fail?

Any help would be greatly appreciated.

Many thanks
Callum


#5

Actually the event would be taken from he queue and then processed once the service would go up. You can simmulate this behavior easily by publishing the event to the RabbitMQ exchange with the discounts service beeing down. Once you start it you sould see that message is beeing consumed once the chanel is estabilshed. This approach gives you this adventage - that at some point you’ll process the incomming messages and even if you don’f for some bazzar reason you can still manage it by putting it on the DLX (which stands for dead letter exchange)