Subscriptions deliver events to event sinks from a Channel.

Creating a subscription

You can create a subscription to connect a service or other event sink to a channel.

Knative Eventing is a Technology Preview feature. The InMemoryChannel type is provided for development use only, and should not be used in a production environment.

  1. Create a Subscription object to connect a channel to a service, by creating a YAML file containing the following:

    apiVersion: messaging.knative.dev/v1beta1
    kind: Subscription
      name: my-subscription (1)
      namespace: default
      channel: (2)
        apiVersion: messaging.knative.dev/v1beta1
        kind: Channel
        name: example-channel
      delivery: (3)
            apiVersion: serving.knative.dev/v1
            kind: Service
            name: error-handler
      subscriber: (4)
          apiVersion: serving.knative.dev/v1
          kind: Service
          name: event-display
    1 Name of the subscription.
    2 Configuration settings for the channel that the subscription connects to.
    3 Configuration settings for event delivery. This tells the subscription what happens to events that cannot be delivered to the subscriber. When this is configured, events that failed to be consumed are sent to the deadLetterSink. The event is dropped, no re-delivery of the event is attempted, and an error is logged in the system. The deadLetterSink value must be a Destination.
    4 Configuration settings for the subscriber. This is the event sink that events are delivered to from the channel.
  2. Apply the YAML file by entering:

    $ oc apply -f <FILENAME>