Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

protocol buffers - Event Driven Microservices: How to send protobuf messages of different types to one AWS SNS(stream)?

I am planning to develop an Event-Driven Microservices.

  1. I create a protobuf project, which defines several types of messages.

    • EmployeeMessage
    • UserMessage
    • ProcessMessage
    • ApplicantMessage
  2. Then, I compile the protobuf project to different languages, e.g. Ruby, Golang.

  3. 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.

  4. Then, the downstream application consumes messages from SQS.

Here is a diagram to show the whole architecture.

enter image description here

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

  1. How do you implement your Event-Driven microservices? Does each type of message have its own SNS (stream)?

  2. 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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...