Skip to content

Fundamentals

Charles d'Avernas edited this page Jul 28, 2023 · 5 revisions

CloudStreams persists cloud events to a global stream used to keep track of all ingested cloud events, regardless of their partition.

A consumer should only subscribe to the global stream (by not setting the partition) in case of complex filtering requirements, or in case of observability or metric production context.

Partitions

CloudStreams partitions ingested cloud events into up to 5 different partition types:

  • by-source: a stream is created for each different source of cloud events consumed by CloudStreams, to allow consumers to query efficiently all the events with a specific source context attribute value.
  • by-type: a stream is created for each different type of cloud events consumed by CloudStreams, to allow consumers to query efficiently all the events with a specific type context attribute value.
  • by-subject: a stream is created for each different subject of cloud events consumed by CloudStreams, to allow consumers to query efficiently all the events with a specific subject context attribute value.
  • by-correlation-id: a stream is created for each different $correlationId metadata value of cloud events consumed by Cloud Streams, to allow consumers to query efficiently all the events with a specific correlationId metadata value.
  • by-causation-id: a stream is created for each different $causationId metadata value of cloud events consumed by Cloud Streams, to allow consumers to query efficiently all the events with a specific causationId metadata value.

A partition allows consumers to efficiently stream only the specific cloud events they are intested in.

A consumer should only consume the specific cloud events it is interested in, and would typically use a by-type partition type.

The id of the partition is the value the cloud events are partitioned by. In the case of a by-type partition, for example, the id would be the value of the type context attributes of all partitioned cloud events.

Subscriptions

To subscribe to cloud events ingested by CloudStreams, you need to create a new subscription resource using the API Server or the Dashboard.

The following represents the subscription resource used to subscribe to all cloud events ingested by CloudStreams, and to dispatch them, at a rate of 1 event every 4 seconds, to an hypothetical webhook.site consumer:

apiVersion: cloud-streams.io/v1
kind: Subscription
metadata:
  name: subscription-1
spec:
  subscriber:
    uri: https://webhook.site/...
    rateLimit: 0.25
Clone this wiki locally