Skip to content
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 set SNS Message Attributes via context #235

Merged
merged 2 commits into from
Nov 5, 2019

Conversation

taraspos
Copy link
Contributor

@taraspos taraspos commented Nov 5, 2019

The suggested fix for issue #131

@jprobinson
Copy link
Contributor

jprobinson commented Nov 5, 2019

Howdy @trane9991! Thanks for contributing!

I like the idea of using the context to pass message attributes, but I wonder if we can do something to clean up the way the key is used for the context values.

You could make a private key type/variable and then provide a new function (something likeWithMessaggeAttributes(context.Context, map[string]*sns.MessageAttributeValue) context.Context maybe?) to add those attributes to the context. Then the Publish func would similarly grab those attributes, but they'd use the private key instead of a string.

Here's an example from the Go blog: https://blog.golang.org/context#TOC_3.2.

@taraspos
Copy link
Contributor Author

taraspos commented Nov 5, 2019

@jprobinson thanks for the suggestion. Done.

Copy link
Contributor

@jprobinson jprobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌯 🔥 ! thanks!

@jprobinson jprobinson merged commit 8e8dc8e into nytimes:master Nov 5, 2019
@jprobinson
Copy link
Contributor

This change has been tagged in https://github.com/nytimes/gizmo/releases/tag/v1.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants