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

nodejs-pubsub: add support for filtering #976

Closed
d-torres opened this issue Apr 21, 2020 · 3 comments
Closed

nodejs-pubsub: add support for filtering #976

d-torres opened this issue Apr 21, 2020 · 3 comments
Assignees
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@d-torres
Copy link

Add an additional field for subscriptions that allows configuring a filter. Filters control what messages are sent to subscribers based on the message attributes.

As an example, if a message filter is the string attributes.event_type = "1", then messages with attributes of event_type=1 will be delivered, while everything else will be filtered out.
There will be more complicated filters to handle prefixes and non-exact matches, but any integration tests can just test the exact match case.

If empty, no messages are filtered out. Filtering can be configured only on subscription creation, not on updates.

Reference implementation in Go will be tracked under googleapis/google-cloud-go#1943

@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/nodejs-pubsub API. label Apr 21, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Apr 22, 2020
@feywind feywind added priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels Apr 22, 2020
@feywind
Copy link
Collaborator

feywind commented Jun 10, 2020

#974 (comment) probably applies here as well.

@feywind
Copy link
Collaborator

feywind commented Jun 12, 2020

Closing this out in favor of the sample issue.

@feywind feywind closed this as completed Jun 12, 2020
@whyvez
Copy link

whyvez commented Mar 17, 2021

Took me quite while to find this but filtering is part of protos.google.pubsub.v1.ISubscription which maps to the request parameter in the createSubscription methods.

https://googleapis.dev/nodejs/pubsub/latest/v1.SubscriberClient.html#createSubscription

await subscription.create({
    filter: 'attributes.kind = "mykind"'
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants