Sequence wired to event-display
The functions used in these examples live in https://github.com/knative/eventing-contrib/blob/master/cmd/appender/main.go.
For this example, we’ll assume you have set up an InMemoryChannel
as well as Knative Serving (for our functions). The examples use default
namespace, again, if you want to deploy to another Namespace, you will need to modify the examples to reflect this.
If you want to use different type of Channel
, you will have to modify the Sequence.Spec.ChannelTemplate
to create the appropriate Channel resources.
kubectl -n default create -f ./steps.yaml
The sequence.yaml
file contains the specifications for creating the Sequence. If you are using a different type of Channel, you need to change the spec.channelTemplate to point to your desired Channel.
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: sequence
spec:
channelTemplate:
kind: InMemoryChannel
- ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: first
- ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: second
- ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: third
reply:
kind: Service
apiVersion: serving.knative.dev/v1
Change default
below to create the Sequence
in the Namespace where you want the resources to be created.
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: event-display
spec:
template:
spec:
containers:
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
Change default
below to create the Sequence
in the Namespace where you want your resources to be created.
kubectl -n default create -f ./event-display.yaml
This will create a PingSource which will send a CloudEvent with {“message”: “Hello world!”} as the data payload every 2 minutes.
kubectl -n default create -f ./ping-source.yaml
kubectl -n default get pods
Wait a bit and then look at the logs for the event-display pod:
And you can see that the initial PingSource message has been appended to it by each of the steps in the Sequence.
Was this page helpful?
Glad to hear it! Please .