lundi 25 juillet 2022

Designing a global event handler

We're currently looking at setting up standards for events that are shared across the system. We work with data that changes often and having a way for all our independent systems to communicate and perform event driven tasks we believe a global event system will be the key to success.

Our product has a large amount (Actually, probably not that large, but I can imagine we're looking at about 1-2 million updates a day) of everchanging data and we need to keep up with these changes. We are able to track changes on the front end, through state management, but on the back end, due to having a large amount of microservices, it is a much bigger task.

A common change, for example, is when a user decides to pay for an order. We have a microservice that handles that order processing, but our analytics service wants to pick up on that processing to track it as a paid order and contribute it towards the daily earnings.

My belief is that we should have a standardised approach using topics for each domain object (eg. Orders/Customers/Payments) in a global event bus with a standardised object with fields like:

  • Object Id
  • Version (To track protocol changes, etc)
  • The object itself (Potentially through graphql instead of the entire object, though there are some pitfalls to this)

I'd then look to push all this information in to something like Amazon SNS where each sub-system could digest the notifications however they like.

My question is really looking for advice on how to approach this and for some anecdotes from people that have attempted this before (Even if you've done something different that would be awesome to hear) to not make too many mistakes.

Aucun commentaire:

Enregistrer un commentaire