mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
29 lines
986 B
Plaintext
29 lines
986 B
Plaintext
[id="serverless-create-kn-trigger_{context}"]
|
|
= Creating a trigger by using the Knative CLI
|
|
|
|
You can create a trigger by using the `kn trigger create` command.
|
|
|
|
.Prerequisites
|
|
|
|
* The {ServerlessOperatorName} and Knative Eventing are installed on your {product-title} cluster.
|
|
* You have installed the `kn` CLI.
|
|
|
|
.Procedure
|
|
|
|
* Create a trigger:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ kn trigger create <trigger_name> --broker <broker_name> --filter <key=value> --sink <sink_name>
|
|
----
|
|
+
|
|
Alternatively, you can create a trigger and simultaneously create the `default` broker using broker injection:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ kn trigger create <trigger_name> --inject-broker --filter <key=value> --sink <sink_name>
|
|
----
|
|
+
|
|
By default, triggers forward all events sent to a broker to sinks that are subscribed to that broker.
|
|
Using the `--filter` attribute for triggers allows you to filter events from a broker, so that subscribers will only receive a subset of events based on your defined criteria.
|