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.

    1. 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.

    1. apiVersion: flows.knative.dev/v1
    2. kind: Sequence
    3. metadata:
    4. name: sequence
    5. spec:
    6. channelTemplate:
    7. kind: InMemoryChannel
    8. - ref:
    9. apiVersion: serving.knative.dev/v1
    10. kind: Service
    11. name: first
    12. - ref:
    13. apiVersion: serving.knative.dev/v1
    14. kind: Service
    15. name: second
    16. - ref:
    17. apiVersion: serving.knative.dev/v1
    18. kind: Service
    19. name: third
    20. reply:
    21. kind: Service
    22. apiVersion: serving.knative.dev/v1

    Change default below to create the Sequence in the Namespace where you want the resources to be created.

    1. apiVersion: serving.knative.dev/v1
    2. kind: Service
    3. metadata:
    4. name: event-display
    5. spec:
    6. template:
    7. spec:
    8. containers:
    9. - 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.

    1. 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.

    1. kubectl -n default create -f ./ping-source.yaml
    1. 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 .