The advanced trigger filters feature adds a new filters
field to triggers that aligns with the filters API field defined in the CloudEvents Subscriptions
API. You can specify filter expressions, where each expression evaluates to true
or false
for each event.
The following example shows a trigger using the advanced filters field:
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
name: my-service-trigger
spec:
broker: default
filters:
- cesql: "source LIKE '%commerce%' AND type IN ('order.created', 'order.updated', 'order.canceled')"
subscriber:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: my-service
The filters
field contains an array of filter expressions, each evaluating to either true
or false
. If any expression evaluates to false
, the event is not sent to the subscriber. Each filter expression uses a specific dialect that determines the type of filter and the set of allowed additional properties within the expression.