Creating a RedisStreamSource

    This topic describes how to create a object.

    RedisStreamSource is a Knative Eventing add-on.

    1. Install RedisStreamSource by running the command:

    2. Verify that redis-controller-manageris running:

      1. kubectl get deployments.apps -n knative-sources

      Example output:

      1. NAME READY UP-TO-DATE AVAILABLE AGE
      2. redis-controller-manager 1/1 1 1 3s

    Create a Service

      1. apiVersion: serving.knative.dev/v1
      2. kind: Service
      3. metadata:
      4. name: event-display
      5. namespace: default
      6. spec:
      7. spec:
      8. containers:
      9. - # This corresponds to
      10. image: gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
    1. Apply the YAML file by running the command:

      Where <filename> is the name of the file you created in the previous step.

      Example output:

      1. service.serving.knative.dev/event-display created
    2. Ensure that the Service Pod is running, by running the command:

      1. kubectl get pods

      The Pod name is prefixed with event-display:

      1. NAME READY STATUS RESTARTS AGE
      2. event-display-00001-deployment-5d5df6c7-gv2j4 2/2 Running 0 72s
    1. Create the RedisStreamSource object using the YAML template below:
    • <redis-stream-source> is the name of your source. (required)
    • <redis-uri> is the Redis URI. See the for more information. (required)
    • <redis-stream-name> is the name of the Redis stream. (required)
    • <consumer-group-name> is the name of the Redis consumer group. When left empty a group is automatically created for this source, and deleted when this source is deleted. (optional)
    • <sink> is where to send events. (required)

    • Apply the YAML file by running the command:

        Where <filename> is the name of the file you created in the previous step.

      Verify the RedisStreamSource object

      1. View the logs for the event-display event consumer by running the command:

        Sample output:

        1. ☁️ cloudevents.Event
        2. Validation: valid
        3. Context Attributes,
        4. specversion: 1.0
        5. type: dev.knative.sources.redisstream
        6. source: /mystream
        7. id: 1597775814718-0
        8. time: 2020-08-18T18:36:54.719802342Z
        9. datacontenttype: application/json
        10. Data,
        11. [
        12. "fruit",
        13. "banana"
        14. "color",
        15. "yellow"
        16. ]

      Additional information

      • For more information about Redis Stream source, see the