Method: projects.locations.messageBuses.publish

messageBuses.publish events to a message bus.

HTTP request

POST https://eventarcpublishing.googleapis.com/v1/{messageBus=projects/*/locations/*/messageBuses/*}:publish

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
messageBus

string

Required. The full name of the message bus to publish events to. Format: projects/{project}/locations/{location}/messageBuses/{messageBus}.

Request body

The request body contains data with the following structure:

JSON representation
{

  // Union field format can be only one of the following:
  "protoMessage": {
    object (CloudEvent)
  },
  "jsonMessage": string,
  "avroMessage": string
  // End of list of possible types for union field format.
}
Fields

Union field format.

format can be only one of the following:

protoMessage

object (CloudEvent)

The Protobuf format of the CloudEvent being published. Specification can be found here: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/protobuf-format.md

jsonMessage

string

The JSON format of the CloudEvent being published. Specification can be found here: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md

avroMessage

string (bytes format)

The Avro format of the CloudEvent being published. Specification can be found here: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/avro-format.md

A base64-encoded string.

Response body

If successful, the response body is empty.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

CloudEvent

CloudEvent represents a vendor-neutral specification for defining the format of event data.

JSON representation
{
  "id": string,
  "source": string,
  "specVersion": string,
  "type": string,
  "attributes": {
    string: {
      object (CloudEventAttributeValue)
    },
    ...
  },

  // Union field data can be only one of the following:
  "binaryData": string,
  "textData": string,
  "protoData": {
    "@type": string,
    field1: ...,
    ...
  }
  // End of list of possible types for union field data.
}
Fields
id

string

Required. Identifies the event. Producers MUST ensure that source + id is unique for each distinct event.

source

string

Required. Identifies the context in which an event happened. URI-reference

specVersion

string

Required. The version of the CloudEvents specification which the event uses.

type

string

Required. This attribute contains a value describing the type of event related to the originating occurrence.

attributes

map (key: string, value: object (CloudEventAttributeValue))

Optional. Used for Optional & Extension Attributes

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Union field data. The event payload. It should be encoded into a media format which is specified by the 'datacontenttype' attribute (e.g. application/json), and adheres to the dataschema format when those respective attributes are present. data can be only one of the following:
binaryData

string (bytes format)

Optional. Binary data.

A base64-encoded string.

textData

string

Optional. Text data.

protoData

object

Optional. Proto data.

An object containing fields of an arbitrary type. An additional field "@type" contains a URI identifying the type. Example: { "id": 1234, "@type": "types.example.com/standard/id" }.

CloudEventAttributeValue

The following abstract data types are available for use in attributes.

JSON representation
{

  // Union field attr can be only one of the following:
  "ceBoolean": boolean,
  "ceInteger": integer,
  "ceString": string,
  "ceBytes": string,
  "ceUri": string,
  "ceUriRef": string,
  "ceTimestamp": string
  // End of list of possible types for union field attr.
}
Fields
Union field attr. The value of the attribute. attr can be only one of the following:
ceBoolean

boolean

Boolean value.

ceInteger

integer

Integer value.

ceString

string

String value.

ceBytes

string (bytes format)

Bytes value.

A base64-encoded string.

ceUri

string

URI value.

ceUriRef

string

URI-reference value.

ceTimestamp

string (Timestamp format)

Timestamp value.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".