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

Support for Trigger filters #272

Closed
tverilytt opened this issue Apr 27, 2016 · 6 comments
Closed

Support for Trigger filters #272

tverilytt opened this issue Apr 27, 2016 · 6 comments
Labels

Comments

@tverilytt
Copy link

Hi!
In some scenarios it would have been handy and practical to be able to specify a filter for a Trigger. The filter could have been passed on to the Feed creating the Trigger. And then the trigger fires only if the filter condition(s) is satisfied.

In a scenario I am having now, I do many concurrent (bulk) upcerts to a Cloudant ddatabase. My OpenWhisk changes feed fires the Trigger for every single upcert. The Trigger calls an Action for every upcert, and in the Action, I do the filtering on certain value(s) of the received document / payload.

Being able to specify the filtering on the Trigger itself, would make the Action simpler, and also one could create many Triggers (with different filters), all calling the same Action. In my scenario, I have to create a new Action (and Rule associating the Action with the Trigger) for every different filter I want to have.

With best regards
-jo2

@tverilytt
Copy link
Author

Maybe the CouchDB / Cloudant Design filter function for change feed can be utilized to specify desired filter function. Filter function can also take query parameter(s), which makes it easier to do more dynamic filtering "on demand"...

Filter functions

https://docs.cloudant.com/design_documents.html#filter-functions

Query parameters:
https://docs.cloudant.com/cloudant_query.html#query-parameters

Filter function with query parameter:

GET /$DATABASE/_changes?filter=$DESIGN_ID/$FILTER_FUNCTION&status=new

Filter function described in CouchDB The Definitive Guide

http://guide.couchdb.org/draft/notifications.html

CouchDB on filter functions with query parameter sample:

http://couchdb.readthedocs.io/en/latest/couchapp/ddocs.html#filterfun

So e.g. when creating OpenWhisk trigger, a "filter" parameter could specify the filter function:

wsk -v trigger create myTrigger --feed /org_space/cloudantPackage/changes --param dbname mydb --param includeDoc true --params filter mailbox/by_status&status=new

@markusthoemmes
Copy link
Contributor

Ou, that looks very promising. Many thanks for digging that out @tverilytt . We should definitly look into integrating that.

@sjfink sjfink added the couchdb label Aug 22, 2016
@rabbah
Copy link
Member

rabbah commented Jan 24, 2017

@johnsolm @dubeejw move to cloudant package repo?

@johnsolm
Copy link

@rabbah yeah. I could see this being a must have for very large databases. moving it to open.

@johnsolm
Copy link

closing this issue as a duplicate of: apache/openwhisk-package-cloudant#55

@johnsolm
Copy link

@rabbah please close this one. I don't seem to be able to do that. I also wanted to label it as a duplicate...

@rabbah rabbah closed this as completed Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants