gcloud eventarc message-buses publish

NAME
gcloud eventarc message-buses publish - publish to an Eventarc message bus
SYNOPSIS
gcloud eventarc message-buses publish(MESSAGE_BUS :--location=LOCATION)(--avro-message=AVRO_MESSAGE    |--json-message=JSON_MESSAGE    | [--event-data=EVENT_DATA--event-id=EVENT_ID--event-source=EVENT_SOURCE--event-type=EVENT_TYPE :--event-attributes=[ATTRIBUTE=VALUE,…]])[GCLOUD_WIDE_FLAG]
DESCRIPTION
Publish to an Eventarc message bus.
EXAMPLES
To publish an event to the message busmy-message-bus with event id1234, event typeevent-provider.event.v1.eventType,event source//event-provider/event/source, event data{"key": "value" } and event attributes ofattribute1=value,run:
gcloudeventarcmessage-busespublishmy-message-bus--location=us-central1--event-id=1234--event-type=event-provider.event.v1.eventType--event-source="//event-provider/event/source"--event-data='{"key": "value"}'--event-attributes=attribute1=value

To publish an event to the message busmy-message-bus with a jsonmessage, run:

gcloudeventarcmessage-busespublishmy-message-bus--location=us-central1--json-message='{"id": 1234, "type": "event-provider.event.v1.eventType", "source": "//event-provider/event/source", "specversion": "1.0", "data": {"key": "value"}}'
POSITIONAL ARGUMENTS
Message bus resource - Message bus to publish to. The arguments in this groupcan be used to specify the attributes of this resource. (NOTE) Some attributesare not given arguments in this group but can be set in other ways.

To set theproject attribute:

  • provide the argumentmessage_bus on the command line with a fullyspecified name;
  • provide the argument--project on the command line;
  • set the propertycore/project.

This must be specified.

MESSAGE_BUS
ID of the message bus or fully qualified identifier for the message bus.

To set themessage-bus attribute:

  • provide the argumentmessage_bus on the command line.

This positional argument must be specified if any of the other arguments in thisgroup are specified.

--location=LOCATION
The location for the Eventarc message bus, which should be one of the supportedregions. Alternatively, set the [eventarc/location] property.

To set thelocation attribute:

  • provide the argumentmessage_bus on the command line with a fullyspecified name;
  • provide the argument--location on the command line;
  • set the propertyeventarc/location.
REQUIRED FLAGS
Exactly one of these must be specified:
--avro-message=AVRO_MESSAGE
An Avro message to publish to the message bus.
--json-message=JSON_MESSAGE
A JSON message to publish to the message bus.
--event-data=EVENT_DATA
An event data. The event data of a published event.

This flag argument must be specified if any of the other arguments in this groupare specified.

--event-id=EVENT_ID
An event id. The id of a published event.

This flag argument must be specified if any of the other arguments in this groupare specified.

--event-source=EVENT_SOURCE
An event source. The event source of a published event.

This flag argument must be specified if any of the other arguments in this groupare specified.

--event-type=EVENT_TYPE
An event type. The event type of a published event.

This flag argument must be specified if any of the other arguments in this groupare specified.

--event-attributes=[ATTRIBUTE=VALUE,…]
Event attributes. The event attributes of a published event.This flag can berepeated to add more attributes.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
This variant is also available:
gcloudbetaeventarcmessage-busespublish

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 2025-07-29 UTC.