Trigger filters
Events flowing through a Broker can be filtered before being sent to targets by means of Trigger filters.
TriggerMesh filters are based on the CloudEvents Subscriptions API filters, which allow for fairly complex filtering against event metadata, known as CloudEvent context attributes. Filters are not supported for the event payload (i.e. the data
attribute of an event). Content-based filtering of entire payload will be added in the future.
As described below, TriggerMesh on Kubernetes provides full control over Trigger filters through its Kubernetes CRD. On the other hand, tmctl
provides a simpler abstraction over filters as described in the Trigger documentation.
Filter operators
Filter operators fall under two categories: string matching functions exact
, prefix
and suffix
, and logical operators all
, any
and not
to combine them. The string matching functions can be used at the root of the filters
attribute without requiring a logical operator.
exact
: the key must exist and exactly match the provided valueprefix
the key must exist and the value include the provided value as a prefixsuffix
the key must exist and the value include the provided value as a suffixall
all operators must evaluate totrue
any
at least one operator must evaluate totrue
not
all operators must evaluate tofalse
Examples
Filter for events whose type
attribute is set to io.triggermesh.demo
Filter for events whose type
attribute is set to io.triggermesh.demo
and category
is set to test
Filter for events whose type
attribute starts with io.triggermesh.
or type
is set to io.tm.demo
Filter for events whose type
attribute does not ends with .avoid.me
or .avoid.me.too
.