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

adds SubscribeAsyncWithNewContext #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

szimmer1
Copy link

Adds and implements an interface method SubscribeAsyncWithNewContext with same signature as SubscribeAsync but is "Context-aware" by creating a new context.Background() to pass to the handler function.

My company has this use case because our server handles incoming requests partly by Publish-ing an event to a topic with at least one async subscriber which makes other outbound network requests. The server cancels the context once it sends a response. Routinely, the cancelled context from the upstream request prevents the subscriber handler function from completing.

This feature allows subscribers to opt into being called with a background Context so that cancelled contexts do not adversely affect them.

@szimmer1
Copy link
Author

Looks like this project supports go versions well before 1.7 when the context package was added to the standard lib. Feel free to close the PR if this is a breaking change.

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.

1 participant