2

After my team went all-out on the microservice paradigm with an emphasis on message passing, I'm having trouble defining and keeping track of all the events in the system.

I've read some guides on the event-driven architecture, and while I get that the messages themselves should be as simple as possible, it still leaves the question of defining their data model open. I'm guessing the publisher should define the properties of a message, but is there a way to ensure type safety in the consumers, similar to Protobuf?

What about keeping track of all of the possible events in the system? Sometimes I'm exploring a repo and there is no way for me to know which service produces a certain event, or if it is even being used any more.

Is there a solution for this broad problem, and what would be the best practises when defining such models? I've heard of people using Apache Avro for the type safety but integrating it would not solve all of the above mentioned issues.

asked Aug 8, 2022 at 16:01
3
  • Are all of the services implemented using the same programming language? If so, then I would use whichever construct that language has available to describe record structures (for example, class or struct) to define messages as plain DTO types in separate shared, versioned libraries/packages (shared between whichever subsystems/processes send or receive them) and treat those as the source of truth concerning what shape and structure each message needs to have. Commented Aug 10, 2022 at 5:26
  • @BenCottrell Most of the services are in fact in one language, but a few of them are not. Commented Aug 10, 2022 at 13:17
  • Currently using Protobuf and works flawlessly. Events are defined on a single repository, code for different languages is generated from the same proto definition, and other services can import it. Commented Aug 12, 2022 at 9:18

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.