- NAME
-
- gcloud pubsub topics publish - publishes a message to the specified topic
- SYNOPSIS
-
-
gcloud pubsub topics publish
TOPIC
[--attribute
=[ATTRIBUTE
,…]] [--message
=MESSAGE
] [--ordering-key
=ORDERING_KEY
] [GCLOUD_WIDE_FLAG …
]
-
- DESCRIPTION
- Publishes a message to the specified topic name for testing and troubleshooting. Use with caution: all associated subscribers must be able to consume and acknowledge any message you publish, otherwise the system will continuously re-attempt delivery of the bad message for 7 days.
- EXAMPLES
-
To publish messages in a batch to a specific Cloud Pub/Sub topic, run:
gcloud pubsub topics publish mytopic --message="Hello World!" --attribute=KEY1=VAL1,KEY2=VAL2
- POSITIONAL ARGUMENTS
-
-
Topic resource - Name of the topic to publish messages to. This represents a
Cloud resource. (NOTE) Some attributes are not given arguments in this group but
can be set in other ways.
To set the
project
attribute:-
provide the argument
topic
on the command line with a fully specified name; -
provide the argument
--project
on the command line; -
set the property
core/project
.
This must be specified.
TOPIC
-
ID of the topic or fully qualified identifier for the topic.
To set the
topic
attribute:-
provide the argument
topic
on the command line.
-
provide the argument
-
provide the argument
-
Topic resource - Name of the topic to publish messages to. This represents a
Cloud resource. (NOTE) Some attributes are not given arguments in this group but
can be set in other ways.
- FLAGS
-
--attribute
=[ATTRIBUTE
,…]- Comma-separated list of attributes. Each ATTRIBUTE has the form name="value". You can specify up to 100 attributes.
--message
=MESSAGE
- The body of the message to publish to the given topic name. Information on message formatting and size limits can be found at: https://cloud.google.com/pubsub/docs/publisher#publish
--ordering-key
=ORDERING_KEY
- The key for ordering delivery to subscribers. All messages with the same ordering key are sent to subscribers in the order that Pub/Sub receives them.
- 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
-
These variants are also available:
gcloud alpha pubsub topics publish
gcloud beta pubsub topics publish
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-02-06 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{
"lastModified": "Last updated 2024-02-06 UTC.",
"confidential": False
}