Creating your first Trigger
Creating your first Trigger
¶
kn trigger create cloudevents-player --sink cloudevents-player
//TODO
Expected Output
Trigger 'cloudevents-player' successfully created in namespace 'default'.
What CloudEvents is my Trigger
listening for?
Since we didn't specify a --filter
in our kn
command, our Trigger is listening for any CloudEvents coming into the Broker
.
Now, when we go back to the CloudEvents Player and send an Event, we see that CloudEvents are both sent and received by the CloudEvents Player:
What if I want to filter on CloudEvent attributes?
First, delete your existing Trigger:
kn trigger delete cloudevents-player
kn trigger create cloudevents-player --sink cloudevents-player --filter type=some-type
If you send a CloudEvent with type "some-type," it will be reflected in the CloudEvents Player UI. Any other types will be ignored by the Trigger
.
You can filter on any aspect of the CloudEvent you would like to.
Some people call this "Event-Driven Architecture" which can be used to create your own "Functions as a Service" on Kubernetes