Pub/Sub - Whole Body, Or Just Notification
I have a EXIF Meta Data Service, after it has succesfully parsed and stored the EXIF Data what should be the contents of its published message?
A) Should it be the full EXIF Data, So any other service intrested can pick its relevent infomation
Or
B) Should it be a "nofication" saying new data is avaliable and if you want it then come and call for it.
---
Option A seems the easiest, and will not cause the service to publish and then been inundated by requests. But it feels dirty sending the whole EXIF Payload for a service only intrested in the taken date!
Option B gives us the ability to stand up specific endpoints with Limited data sets, Only want Geo Coords? you got it!
I Guess I could have an Option C, Which sends a limited amount of data any if anymore is needed then it can be called for??
Love to hear your views! I Would google for it, but not 100% of terms i'd use..
Posted Sep 14, 2020, 11:32 AM UTC
I think the reason for going with B would be traceability and probably simplified debugging. Like if you are writing json payloads to S3 and the providing the URL to the item in the notification, you can always look back at historic payloads if you need to, or recover past data.
If it's all in the message, you might risk losing that to a max-age time out on the message service.
It's probably something where you can start with A as it has fewer moving parts, and then move to B with very little pain if you find the need, and enrich you messages for C if you find that use case as well.