In this sample, we'll take a look at how to call a service on a schedule in Knative Eventing.
For the event consumer, we can use the Event Display service in Hello World Eventing sample. Go through the steps mentioned there to create and deploy the Event Display service.
Create a source.yaml in the same namespace (in this case default
) as your service.
In this case, we have the service as the sink. We'll be calling the Event Display service every minute.
Create the PingSource
:
kubectl apply -f source.yaml
We can see that the service is triggered every minute in the service logs:
kubectl logs --follow <podid>
Event Display received event: {"message":"Hello world from ping!"}
Make sure there's a Broker in the default namespace by following instructions in Broker Creation page.
Next, setup PingSource
to point to our Broker instead.
Create a source-broker.yaml.
In this case, we have the Broker in the default namespace as the sink.
Create the event source:
kubectl apply -f source-broker.yaml
You need to create a trigger.yaml to listen for events.
Notice that we're filtering on Ping events.
kubectl apply -f trigger.yaml
At this point, you should see scheduled events in the Event Display.