Skip to content

Event consumers should not need knowledge of how events get routed #815

@bbrowning

Description

@bbrowning

This is the consumer side of #814

When consuming events from Knative Eventing today, those events are consumed from a Channel by creating a Subscription. An example:

apiVersion: eventing.knative.dev/v1alpha1
kind: Subscription
metadata:
  name: cronjob-source-sample
spec:
  channel:
    apiVersion: eventing.knative.dev/v1alpha1
    kind: Channel
    name: testchannel
  subscriber:
    ref:
      apiVersion: serving.knative.dev/v1alpha1
      kind: Service
      name: message-dumper

This requires making a decision every time a subscription - what Channel should this consume events from and do I need to create that Channel?

What's lacking is a way to consume events from Knative Eventing without having to make a decision about how that event was produced or routed. Instead, I'd like to consume events from based on the CloudEvents attributes or body of that event - source, type, fields within the body, etc.

Something like this:

apiVersion: eventing.knative.dev/v1alpha1
kind: Subscription
metadata:
  name: cronjob-source-sample
spec:
  filter:
    type: 'dev.knative.cronjob.event'
  subscriber:
    ref:
      apiVersion: serving.knative.dev/v1alpha1
      kind: Service
      name: message-dumper

Or, if we have some concept of a well-known and statically named event Bucket (naming TBD, also referred to as Broker or Router) then something like:

apiVersion: eventing.knative.dev/v1alpha1
kind: Subscription
metadata:
  name: cronjob-source-sample
spec:
  bucket:
    apiVersion: eventing.knative.dev/v1alpha1
    kind: Bucket
    name: default
  filter:
    type: 'dev.knative.cronjob.event'
  subscriber:
    ref:
      apiVersion: serving.knative.dev/v1alpha1
      kind: Service
      name: message-dumper

See Knative Eventing use cases and product requirements - 2019 and Broker and Trigger for some prior discussion and ideas around these topics. Those docs should be visible to anyone in the knative-users Google Group.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions