mardi 1 mars 2022

Using Kafka as a Source of truth (async)

I would like to see opinions about using kafka how source of truth in a microservices architecture (async).

Case:

1 - Customer do a order

2 - Customer is redirect to a page with order's details

Architecture:

1 - Event is send to kafka topic

2 - Order microservice consume the event and save in the database

Doubt: When the customer is redirect to order details page can be a delay and my microservice could not consume the event yet. What's the best practices?

  • keep tryng get the order detail (wait in the interface) until the order is returned by order microservice?

  • Workaround in the user interface with cache (client side)?

  • is better write in the database first and catch the event with CDC (for example) to ingest in the kafka topic and distribute to anothers consumers(microservices)?

Aucun commentaire:

Enregistrer un commentaire