-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to specify the MessageAttributes when publishing an event #131
Comments
Howdy @alessandrozucca! Sorry for the delay, I've been thinking about this one since you posted. While it does seem handy, I do worry about this leading to a leaky abstraction as we've been trying to find the lowest common denominator between SNS, Kafka & Google PubSub. I do see that PubSub also has attributes but I haven't found something similar in the Kafka world so I'm a bit hesitant to alter our main interface. Perhaps we can make a new Publisher interface (similar to the |
Hi @jprobinson Sorry for the delay in the response and happy new year 🎉 I understand your reason for not wanting to change the main interface. Creating a new Publisher that allows to specify the message attributes makes sense. In the meanwhile, to get this working, I have already added in a local package an interface (with a third argument |
I get the reason for not adding it, but I would love to see this added in somehow. |
@jprobinson what if attributes will be passed via context, so there is no need to change the interface and context will be optionally handled? Something like: if v, ok := ctx.Value("MessageAttributes").(map[string]*sns.MessageAttributeValue); ok {
msg.MessageAttributes = v
} |
Think this issue can be closed - I have just noticed that this has been implemented 😄 |
@trane9991 is possible to do similar thing for google pub/sub? I want to set attribute for my event which will be sent to google pub/sub if v, ok := ctx.Value("MessageAttributes").(map[string]*sns.MessageAttributeValue); ok {
msg.MessageAttributes = v
} |
In order to be able to use the attribute based filtering, would be nice if the
Publisher
allowed to specify the MessageAttributes field insns.PublishInput
so basically have something like:ref. https://aws.amazon.com/blogs/compute/simplify-pubsub-messaging-with-amazon-sns-message-filtering/
The text was updated successfully, but these errors were encountered: