Question about consistency between microservices


Hello, after watching episodes 3 & 4 I have question about data consistency in some cases. Especially what happens when one service goes down for a while, and in this time e.g. some user is removed or just updated. This service now has outdated data in it’s local mongo repository and causes errors in system, by e.g. sending emails to removed user, or sending them with wrong name.

Thanks, Szymon.


The “user” service is down and couldn’t update user, but your email/notification svc should not be able to get user email since it’s down?


Thanks for the reply.
Yes, in case of this application where user saved in the notification service database would have only id, but if it had first_name also saved, then it would use local outdated version. Maybe then you shouldn’t keep first_name in notification service database, but that was not the case. What is the user gets removed?
Well, now I know, how it works and where I made a mistake. I thought that when event user_removed is dispatched then it’s only being delivered to currently listening applications. Turns out that if notification service registers to rabbitmq exchange, and then goes down, that message will be queued and will wait until service works again and can handle that event.
That ensures that after a given time everything will become consistent. I just didn’t have enough knowledge of rabbitmq / event exchange and queuing mechanism :smile: