8

I have concern when handling communication between Frontend and Backend in Event-Driven Microservices architecture:

Use case: User creates new product then he go to product list to check. The flow will be as below enter image description here

My question is how the UI handle product list in this case? The new product may not be present because the read side haven't processed new product event.

3
  • You have at least 3 questions here. This question is too broad. Commented Jul 17, 2019 at 11:45
  • 2
    I updated the question now it just focus on handling UI in Event-Driven Microservices Commented Jul 17, 2019 at 11:54
  • That's possible since you are using CQRS Pattern. Generally in distributed system we prefer eventual consistency over strong consistency to make it scale-able. So there's a trade-off. In your scenario really depends how long it would take to reflect change from Write to read database but i assume it shouldn't be long. If it is then you have to manage it accordingly on UI end. Commented Jul 18, 2019 at 3:51

1 Answer 1

2

That's possible since you are using CQRS Pattern. Generally in distributed system we prefer eventual consistency over strong consistency to make it scale-able. So there's a trade-off.

In your scenario really depends how long it would take to reflect change from Write to read database but i assume it shouldn't be long. If it is then you have to manage it accordingly on UI end e.g. As soon as your enter the product in your system you may need to return ID, that your UI would poll in read database and meanwhile user has wait screen. Or better you may have to use Websockets to avoid polling and update UI as soon as product is available on read side

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.