mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
28 lines
1.2 KiB
Plaintext
28 lines
1.2 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * /serverless/develop/serverless-triggers.adoc
|
|
|
|
:_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
|
|
|
|
Using the Knative (`kn`) CLI to filter events by using triggers provides a streamlined and intuitive user interface. You can use the `kn trigger create` command, along with the appropriate flags, to filter events by using triggers.
|
|
|
|
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
|
|
----
|