跳到主要内容

CloudEvents

The goal of the CloudEvents specification is to define the interoperability of event systems that allow services to produce or consume events, where the producer and consumer are loosely coupled during development, deployed independently, and later can be connected to create new applications.

CloudEvents, at its core, is a specification for describing event data in common formats to provide interoperability across services, platforms and systems. And beyond the core specification, CloudEvents also contains SDKs and other specifications for other aspects of Eventing/Messaging, such as Subscription, Discovery, Schema Registry, etc.

Vanus is built around the CloudEvents specifications and integrated with CloudEvents SDKs.

CloudEvent

CloudEvent

An "event" is a data record expressing an occurrence and its context. So, the CloudEvent will contain two types of information: the Event Data representing the Occurrence and Context metadata providing contextual information about the Occurrence.

Context Attributes

A CloudEvent MUST include context attributes designated as REQUIRED, MAY include one or more OPTIONAL context attributes and MAY include one or more extension context attributes.

REQUIRED Attributes

id
Identifies the event.
source
Identifies the context in which an event happened. Often this will include information such as the type of the event source, the organization publishing the event or the process that produced the event.
specversion
The version of the CloudEvents specification which the event uses.
type
This attribute contains a value describing the type of event related to the originating occurrence. Often this attribute is used for routing, observability, policy enforcement, etc.

OPTIONAL Attributes

datacontenttype
Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.
dataschema
Identifies the schema that data adheres to.
subject
This describes the subject of the event in the context of the event producer (identified by source).
time
Timestamp of when the occurrence happened.

Extension Context Attributes

A CloudEvent MAY include any number of additional context attributes with distinct names, known as "extension attributes". They allow external systems to attach metadata to an event.

See CloudEvent Attributes Extensions for additional information concerning the use and definition of extensions.

Event Data

A CloudEvent MAY include domain-specific information about the occurrence. When present, this information will be encapsulated within data.

Example

The following example shows a CloudEvent serialized as JSON:

{
"specversion" : "1.0",
"type" : "com.github.pull_request.opened",
"source" : "https://github.com/cloudevents/spec/pull",
"subject" : "123",
"id" : "A234-1234-1234",
"time" : "2018-04-05T17:31:00Z",
"comexampleextension1" : "value",
"comexampleothervalue" : 5,
"datacontenttype" : "text/xml",
"data" : "<much wow=\"xml\"/>"
}

CloudEvents SDKs

The CloudEvents team is committed to supporting and maintaining the following SDKs:

See CloudEvents' website for more details.