CloudEvent interface

A CloudEvent describes event data.

Signature:

exportinterfaceCloudEvent

Properties

PropertyTypeDescription
dataobject | stringData payload of the event. Objects are stringified with JSON and strings are be passed along as-is.
datacontenttypestringMIME type of the data being sent with the event in thedata field. Onlyapplication/json andtext/plain are currently supported. If not specified, it is automatically inferred from the type of provided data.
idstringIdentifier for the event. If not provided, it is auto-populated with a UUID.
sourcestringIdentifies the context in which an event happened. If not provided, the value ofEVENTARC_CLOUD_EVENT_SOURCE environment variable is used and if that is not set, a validation error is thrown.
specversionCloudEventVersionThe version of the CloudEvents specification which the event uses. If not provided, is set to1.0 -- the only supported value.
subjectstringSubject (context) of the event in the context of the event producer.
timestringTimestamp of the event. Must be in ISO time format. If not specified, current time (at the moment of publishing) is used.
typestringType of the event. Should be prefixed with a reverse-DNS name (com.my-org.v1.something.happended).

CloudEvent.data

Data payload of the event. Objects are stringified with JSON and strings are be passed along as-is.

Signature:

data?:object|string;

CloudEvent.datacontenttype

MIME type of the data being sent with the event in thedata field. Onlyapplication/json andtext/plain are currently supported. If not specified, it is automatically inferred from the type of provided data.

Signature:

datacontenttype?:string;

CloudEvent.id

Identifier for the event. If not provided, it is auto-populated with a UUID.

Signature:

id?:string;

CloudEvent.source

Identifies the context in which an event happened. If not provided, the value ofEVENTARC_CLOUD_EVENT_SOURCE environment variable is used and if that is not set, a validation error is thrown.

Signature:

source?:string;

CloudEvent.specversion

The version of the CloudEvents specification which the event uses. If not provided, is set to1.0 -- the only supported value.

Signature:

specversion?:CloudEventVersion;

CloudEvent.subject

Subject (context) of the event in the context of the event producer.

Signature:

subject?:string;

CloudEvent.time

Timestamp of the event. Must be in ISO time format. If not specified, current time (at the moment of publishing) is used.

Signature:

time?:string;

CloudEvent.type

Type of the event. Should be prefixed with a reverse-DNS name (com.my-org.v1.something.happended).

Signature:

type:string;

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2022-07-29 UTC.