1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/kn-trigger-filtering.adoc
2023-10-30 10:13:25 -04:00

26 lines
1011 B
Plaintext

// Module included in the following assemblies:
//
// * /serverless/eventing/triggers/filter-triggers-cli.adoc
:_mod-docs-content-type: REFERENCE
[id="kn-trigger-filtering_{context}"]
= Filtering events with triggers by using the Knative CLI
// should be a procedure module but out of scope for this PR
In the following trigger example, only events with the attribute `type: dev.knative.samples.helloworld` are sent to the event sink:
[source,terminal]
----
$ kn trigger create <trigger_name> --broker <broker_name> --filter type=dev.knative.samples.helloworld --sink ksvc:<service_name>
----
You can also filter events by using multiple attributes. The following example shows how to filter events using the type, source, and extension attributes:
[source,terminal]
----
$ kn trigger create <trigger_name> --broker <broker_name> --sink ksvc:<service_name> \
--filter type=dev.knative.samples.helloworld \
--filter source=dev.knative.samples/helloworldsource \
--filter myextension=my-extension-value
----