I am planning to develop an Event-Driven Microservices.
I create a protobuf project, which defines several types of messages.
- EmployeeMessage
- UserMessage
- ProcessMessage
- ApplicantMessage
Then, I compile the protobuf project to different languages, e.g. Ruby, Golang.
Then, the upstream application will push the following type of events to the SNS, the SNS fanout message to multiple SQS, which owned by the different downstream consumers.
Then, the downstream application consumes messages from SQS.
Here is a diagram to show the whole architecture.
When implementing it, I realize there is no way. Protobuf messages of different types are posted to SNS, the consumer doesn't know the type of each message and is not able to decode them.
Questions
How do you implement your Event-Driven microservices? Does each type of message have its own SNS (stream)?
Is there a way to allow me to push different message types to the same SNS (stream)? Do I need to append the message type in front of the payload?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…