Replies: 1 comment 1 reply
-
Interesting idea! A couple of thoughts spring to mind:
|
Beta Was this translation helpful? Give feedback.
-
Interesting idea! A couple of thoughts spring to mind:
|
Beta Was this translation helpful? Give feedback.
-
Currently when receiving a message from SNS -> SQS it's an SNS message, with a
Message
property with the serialized message json within it.SNS has an optional
Subject
parameter (which primarily comes from SNS support for email endpoints) which appears as a top level property in the SNS message body (outside of the "regular message body").JustSaying sets this property today, and sets it from the message type that is being published. We apply a deterministic function to get the subject name, and then we use that as a key to the serializer for that subscription, in something we call the "message serializer registry".
This seems a bit pointless, in that we have enough context within JustSaying to know from the queue url being subscribed to, which serializer to use. The subject doesn't "tell us" anything really, it's more of an implementation detail, and is simply required to match on both sides (publisher & subscriber) in order to pick the right serializer from the many that might be available as a result of subscribing to different events.
To say it another way, the subject may look like it's the message type name and has meaning, but really it's just a hash of the message type (but human readable).
One problem that follows from requiring a subject property is that vanilla message bodies cannot be supported transparently, there are at least two scenarios this pops up:
Today the above two approaches require wrapping the message in a JSON object, double escaping the underlying message and added a subject property. We could remove this requirement if we made subject optional.
A negative to removing subject is you couldn't easily support different message types in 1 queue. Also if you started to remove subject from publishers, this would be a breaking change to previous subscribers.
Beta Was this translation helpful? Give feedback.
All reactions