Skip to content

adds SubscribeAsyncWithNewContext#37

Open
szimmer1 wants to merge 1 commit intoasaskevich:masterfrom
szimmer1:subscribe-async-context-aware
Open

adds SubscribeAsyncWithNewContext#37
szimmer1 wants to merge 1 commit intoasaskevich:masterfrom
szimmer1:subscribe-async-context-aware

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