HomeGuidesAPI ReferenceGuidesMRT APIConfiguration API
GitHubAirheads Developer Community
Guides

CloudEvents

Overview

All streaming messages published by Central are delivered as CloudEvents, encoded using Google Protocol Buffers.

Each message received from the Streaming APIs follows a two-step decoding process:

  1. CloudEvent envelope decoding
  2. Event-specific payload decoding, based on the event

This page documents the CloudEvent schema that applies to all Streaming API messages.

How Streaming Messages Are Structured

Every message received from the Streaming APIs is a serialized CloudEvent published by Central.
The CloudEvent acts as a wrapper that provides common metadata and contains the actual event payload.

The payload must be decoded separately using the event-specific Protocol Buffer schema documented on each event page.

Message Decoding Flow

When consuming messages from the Streaming APIs:

  1. Decode the incoming WebSocket message using the CloudEvent Protocol Buffer schema
  2. Inspect the event type
  3. Use the corresponding event-specific .proto file to deserialize the payload

This decoding model is consistent across all Streaming API events.

Proto File

Streaming API messages are encoded according to the following CloudEvent Protocol Buffer schema, published by Central.

You must use this schema to deserialize the CloudEvent envelope before processing the event payload.

syntax = "proto3";

package cloudevents.v1;

import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";

message CloudEvent {
  /**
   * Required CloudEvent attribute.
   * The unique identifier of the event.
   */
  string id = 1;

  /**
   * Required CloudEvent attribute.
   * The source of the event.
   */
  string source = 2;

  /**
   * Required CloudEvent attribute.
   * The version of the CloudEvents specification.
   */
  string specversion = 3;

  /**
   * Required CloudEvent attribute.
   * The type of the event.
   */
  string type = 4;

  /**
   * Represents the timestamp of the event.
   * This field is used to indicate the time when the event occurred.
   * Timestamp of when the event occurred in RFC 3339 format.
   */
  google.protobuf.Timestamp time = 9;

  /**
   * Represents the content type of the event data.
   * This field is used to specify the format of the event data.
   * The encoding of the data in the dataproperty as an RFC 2046 type.
   */
  string datacontenttype = 10;

  /**
   * Represents the schema of the event data.
   * This field is used to specify the schema that the event data adheres to.
   * Identifies the schema of the data property.
   */
  string dataschema = 11;

  /**
   * Optional and extension attributes of the CloudEvent.
   * subject, traceparent, tracestate
   */
  map<string, CloudEventAttributeValue> attributes = 5;

  /**
   * The data of the CloudEvent.
   * It can be either binary data, text data, or a protobuf message.
   * Event payload. The contents is marshalled according to the media type in datacontenttype.
   */
  oneof data {
    /**
     * Binary data of the CloudEvent.
     */
    bytes binary_data = 6;

    /**
     * Text data of the CloudEvent.
     */
    string text_data = 7;

    /**
     * Protobuf message data of the CloudEvent.
     */
    google.protobuf.Any proto_data = 8;
  }
}

/**
 * Represents the value of a CloudEvent attribute.
 */
message CloudEventAttributeValue {
  oneof value {
    /**
     * Represents a boolean value.
     */
    bool ce_boolean = 1;

    /**
     * Represents an integer value.
     */
    int32 ce_integer = 2;

    /**
     * Represents a string value.
     */
    string ce_string = 3;

    /**
     * Represents a bytes value.
     */
    bytes ce_bytes = 4;

    /**
     * Represents a URI value.
     */
    string ce_uri = 5;

    /**
     * Represents a URI reference value.
     */
    string ce_uri_ref = 6;

    /**
     * Represents a timestamp value.
     */
    google.protobuf.Timestamp ce_timestamp = 7;
  }
}

After decoding the CloudEvent envelope, the type field identifies the specific Streaming API event contained in the message. Each event type corresponds to a topic-specific payload schema and documentation.

The following sections list the Streaming API events currently supported by Central and link to their respective event definitions.

Supported Events

The following event types are currently supported by the Streaming APIs. Each event links to detailed documentation describing its payload schema and supported filters.