Google PubSub
Publish to Google Cloud Pub/Sub topics and pull, ack and nack messages from subscriptions, with a service account or the emulator. Typical uses: exchange events with Google Cloud services, read a subscription in a job.
pubsub pingpubsub topic_createpubsub topic_createpubsub topicspubsub topicspubsub subscription_createpubsub subscription_createpubsub subscriptionspubsub subscriptionspubsub publishpubsub publishpubsub publish_batchpubsub publish_batchpubsub consumepubsub consumepubsub ackpubsub nackpubsub subscription_droppubsub topic_drop
pubsub ping <config>
Description
Check the access with a cheap call (the first topic). Returns {ok, latency_ms}; a failure is an error
Check the access with a cheap call (the first topic). Returns {ok, latency_ms}; a failure is an error
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
admin
pubsub ping "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}"
mentdb
{"ok": true, "latency_ms": 4}
pubsub topic_create <config> <topic>
Description
Create a topic. An existing topic is an error (ALREADY_EXISTS). Returns {topic, path}
Create a topic. An existing topic is an error (ALREADY_EXISTS). Returns {topic, path}
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects//topics/ in the project of the configuration - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects/
admin
pubsub topic_create "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders"
mentdb
{"topic": "orders", "path": "projects/demo-project/topics/orders"}
pubsub topic_create <config> <topic> <json_params>
Description
Create a topic with parameters: labels (a JSON object), retention_ms (the retention of the topic, 10 minutes to 31 days)
Create a topic with parameters: labels (a JSON object), retention_ms (the retention of the topic, 10 minutes to 31 days)
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects//topics/ in the project of the configuration - String - required
json_params: The parameters - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects/
json_params: The parameters - String - required
admin
pubsub topic_create "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "audit" "{\"labels\": {\"team\": \"erp\"}}"
mentdb
{"topic": "audit", "path": "projects/demo-project/topics/audit"}
again (fixed result: the official Google Cloud Pub/Sub emulator 0.8.38, not Google Cloud)
admin
pubsub topic_create "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "audit"
mentdb
ERROR: Sorry, an error appears (Pub/Sub error ALREADY_EXISTS: Topic already exists (HTTP 409)).
pubsub topics <config>
Description
List the topics of the project, following the pages. Returns rows {name, path}, with labels when present
List the topics of the project, following the pages. Returns rows {name, path}, with labels when present
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
admin
pubsub topics "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}"
mentdb
[{"name": "audit", "path": "projects/demo-project/topics/audit", "labels": {"team": "erp"}}, {"name": "orders", "path": "projects/demo-project/topics/orders"}]
pubsub topics <config> <json_params>
Description
List the topics with parameters: limit (1000, up to 1000000)
List the topics with parameters: limit (1000, up to 1000000)
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
json_params: The parameters - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
json_params: The parameters - String - required
admin
pubsub topics "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "{\"limit\": 1}"
mentdb
[{"name": "audit", "path": "projects/demo-project/topics/audit", "labels": {"team": "erp"}}]
pubsub subscription_create <config> <subscription> <topic>
Description
Create a pull subscription on a topic, ack deadline 10 seconds. Returns {subscription, topic, path, ack_deadline_seconds}
Create a pull subscription on a topic, ack deadline 10 seconds. Returns {subscription, topic, path, ack_deadline_seconds}
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects//subscriptions/ - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects//topics/ in the project of the configuration - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects/
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects/
admin
pubsub subscription_create "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders-erp" "orders"
mentdb
{"subscription": "orders-erp", "topic": "orders", "path": "projects/demo-project/subscriptions/orders-erp", "ack_deadline_seconds": 10}
pubsub subscription_create <config> <subscription> <topic> <json_params>
Description
Create a subscription with parameters: ack_deadline_seconds (10 to 600), filter (on the attributes, ex: attributes.region = "eu"), retain_acked, retention_ms, ordering (by ordering_key), exactly_once, push_endpoint (an https URL: a push subscription), labels, dead_letter_topic and max_delivery_attempts (5 to 100)
Create a subscription with parameters: ack_deadline_seconds (10 to 600), filter (on the attributes, ex: attributes.region = "eu"), retain_acked, retention_ms, ordering (by ordering_key), exactly_once, push_endpoint (an https URL: a push subscription), labels, dead_letter_topic and max_delivery_attempts (5 to 100)
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects//subscriptions/ - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects//topics/ in the project of the configuration - String - required
json_params: The parameters - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects/
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects/
json_params: The parameters - String - required
admin
pubsub subscription_create "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders-eu" "orders" "{\"ack_deadline_seconds\": 30, \"filter\": \"attributes.region = \\"eu\\"\"}"
mentdb
{"subscription": "orders-eu", "topic": "orders", "path": "projects/demo-project/subscriptions/orders-eu", "ack_deadline_seconds": 30}
pubsub subscriptions <config>
Description
List the subscriptions of the project. Returns rows {name, path, topic, ack_deadline_seconds}, with filter, push_endpoint and labels when present
List the subscriptions of the project. Returns rows {name, path, topic, ack_deadline_seconds}, with filter, push_endpoint and labels when present
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
admin
pubsub subscriptions "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}"
mentdb
[{"name": "orders-erp", "path": "projects/demo-project/subscriptions/orders-erp", "topic": "orders", "ack_deadline_seconds": 10}, {"name": "orders-eu", "path": "projects/demo-project/subscriptions/orders-eu", "topic": "orders", "ack_deadline_seconds": 30, "filter": "attributes.region = \\"eu\\""}]
pubsub subscriptions <config> <topic>
Description
List the subscriptions of a topic. Returns rows {name, path, topic}
List the subscriptions of a topic. Returns rows {name, path, topic}
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects//topics/ in the project of the configuration - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects/
admin
pubsub subscriptions "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders"
mentdb
[{"name": "orders-erp", "path": "projects/demo-project/subscriptions/orders-erp", "topic": "orders"}, {"name": "orders-eu", "path": "projects/demo-project/subscriptions/orders-eu", "topic": "orders"}]
pubsub publish <config> <topic> <body>
Description
Publish a text. Returns {message_id}
Publish a text. Returns {message_id}
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects//topics/ in the project of the configuration - String - required
body: The text, sent in UTF-8 (7.5 MB at most) - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects/
body: The text, sent in UTF-8 (7.5 MB at most) - String - required
admin
pubsub publish "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders" "order 1"
mentdb
{"message_id": "1"}
pubsub publish <config> <topic> <body> <json_params>
Description
Publish with parameters: attributes (a JSON object of texts, 100 at most), ordering_key (for a subscription with ordering), encoding (utf-8, or base64: the body is decoded and sent as bytes)
Publish with parameters: attributes (a JSON object of texts, 100 at most), ordering_key (for a subscription with ordering), encoding (utf-8, or base64: the body is decoded and sent as bytes)
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects//topics/ in the project of the configuration - String - required
body: The text or the base64 - String - required
json_params: The parameters - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects/
body: The text or the base64 - String - required
json_params: The parameters - String - required
admin
pubsub publish "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders" "//4Aaw==" "{\"encoding\": \"base64\", \"attributes\": {\"region\": \"eu\"}}"
mentdb
{"message_id": "2"}
pubsub publish_batch <config> <topic> <json_rows>
Description
Publish a list of rows {body, attributes, ordering_key} (only body is needed) by requests of 1000 messages and 9 MB. Returns {sent, failed, not_attempted, errors}: errors has at most 100 entries {row, error}; an invalid row does not stop the list; a request that fails stops it
Publish a list of rows {body, attributes, ordering_key} (only body is needed) by requests of 1000 messages and 9 MB. Returns {sent, failed, not_attempted, errors}: errors has at most 100 entries {row, error}; an invalid row does not stop the list; a request that fails stops it
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects//topics/ in the project of the configuration - String - required
json_rows: The messages as a JSON array of objects (100000 at most). A body that is not a text is sent as JSON - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects/
json_rows: The messages as a JSON array of objects (100000 at most). A body that is not a text is sent as JSON - String - required
admin
pubsub publish_batch "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders" "[{\"body\": \"order 3\", \"attributes\": {\"region\": \"us\"}}, {\"text\": \"no body\"}, {\"body\": {\"id\": 4}, \"attributes\": {\"region\": \"eu\"}}]"
mentdb
{"sent": 2, "failed": 1, "not_attempted": 0, "errors": [{"row": 1, "error": "the field 'body' is missing"}]}
pubsub publish_batch <config> <topic> <json_rows> <json_params>
Description
Publish a list with parameters: body_field (body), attributes (for every row; those of a row are added), encoding (utf-8)
Publish a list with parameters: body_field (body), attributes (for every row; those of a row are added), encoding (utf-8)
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects//topics/ in the project of the configuration - String - required
json_rows: The messages as a JSON array of objects (100000 at most). A body that is not a text is sent as JSON - String - required
json_params: The parameters - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects/
json_rows: The messages as a JSON array of objects (100000 at most). A body that is not a text is sent as JSON - String - required
json_params: The parameters - String - required
admin
pubsub publish_batch "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders" "[{\"v\": \"order 5\"}]" "{\"body_field\": \"v\", \"attributes\": {\"region\": \"eu\"}}"
mentdb
{"sent": 1, "failed": 0, "not_attempted": 0, "errors": []}
pubsub consume <config> <subscription>
Description
Pull and acknowledge at most 100 messages and 16 MB, waiting up to 5 seconds on an empty subscription. Returns rows {body, encoding, message_id, ack_id, attributes, publish_time}, with ordering_key and delivery_attempt when present
Pull and acknowledge at most 100 messages and 16 MB, waiting up to 5 seconds on an empty subscription. Returns rows {body, encoding, message_id, ack_id, attributes, publish_time}, with ordering_key and delivery_attempt when present
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects//subscriptions/ - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects/
admin
pubsub consume "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders-eu"
mentdb
[{"body": "//4Aaw==", "encoding": "base64", "message_id": "2", "ack_id": "projects/demo-project/subscriptions/orders-eu:1", "attributes": {"region": "eu"}, "publish_time": "2026-11-17T16:25:35.823Z"}, {"body": "{\\"id\\": 4}", "encoding": "utf-8", "message_id": "4", "ack_id": "projects/demo-project/subscriptions/orders-eu:2", "attributes": {"region": "eu"}, "publish_time": "2026-11-17T16:25:36.609Z"}, {"body": "order 5", "encoding": "utf-8", "message_id": "5", "ack_id": "projects/demo-project/subscriptions/orders-eu:3", "attributes": {"region": "eu"}, "publish_time": "2026-11-17T16:25:37.372Z"}]
pubsub consume <config> <subscription> <json_params>
Description
Pull with parameters: max_messages (100, up to 100000), wait_ms (5000, up to 600000; 0: one pull of 1 second), ack (true; false: see pubsub ack and pubsub nack), max_bytes (16 MB, up to 256 MB)
Pull with parameters: max_messages (100, up to 100000), wait_ms (5000, up to 600000; 0: one pull of 1 second), ack (true; false: see pubsub ack and pubsub nack), max_bytes (16 MB, up to 256 MB)
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects//subscriptions/ - String - required
json_params: The parameters - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects/
json_params: The parameters - String - required
admin
pubsub consume "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders-erp" "{\"ack\": false, \"max_messages\": 2}"
mentdb
[{"body": "order 1", "encoding": "utf-8", "message_id": "1", "ack_id": "projects/demo-project/subscriptions/orders-erp:4", "attributes": {}, "publish_time": "2026-11-17T16:25:35.057Z"}, {"body": "//4Aaw==", "encoding": "base64", "message_id": "2", "ack_id": "projects/demo-project/subscriptions/orders-erp:5", "attributes": {"region": "eu"}, "publish_time": "2026-11-17T16:25:35.823Z"}]
nothing more within one second (fixed result: the official Google Cloud Pub/Sub emulator 0.8.38, not Google Cloud)
admin
pubsub consume "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders-eu" "{\"wait_ms\": 1000}"
mentdb
[]
pubsub ack <config> <subscription> <ack_ids>
Description
Acknowledge messages by their ack ids, by requests of 1000. Returns {acked}
Acknowledge messages by their ack ids, by requests of 1000. Returns {acked}
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects//subscriptions/ - String - required
ack_ids: The ack ids: one text, a JSON array of texts, or the rows of pubsub consume (field ack_id); 100000 at most - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects/
ack_ids: The ack ids: one text, a JSON array of texts, or the rows of pubsub consume (field ack_id); 100000 at most - String - required
admin
pubsub ack "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders-erp" "projects/demo-project/subscriptions/orders-erp:4"
mentdb
{"acked": 1}
an id that is not valid (fixed result: the official Google Cloud Pub/Sub emulator 0.8.38, not Google Cloud)
admin
pubsub ack "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders-erp" "bad"
mentdb
ERROR: Sorry, an error appears (Pub/Sub error INVALID_ARGUMENT: Invalid ack id (ack_id=bad) (HTTP 400)).
pubsub nack <config> <subscription> <ack_ids>
Description
Give back messages at once (ack deadline 0), by their ack ids. Returns {nacked}
Give back messages at once (ack deadline 0), by their ack ids. Returns {nacked}
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects//subscriptions/ - String - required
ack_ids: The ack ids: one text, a JSON array of texts, or the rows of pubsub consume (field ack_id); 100000 at most - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects/
ack_ids: The ack ids: one text, a JSON array of texts, or the rows of pubsub consume (field ack_id); 100000 at most - String - required
admin
pubsub nack "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders-erp" "projects/demo-project/subscriptions/orders-erp:5"
mentdb
{"nacked": 1}
pubsub subscription_drop <config> <subscription>
Description
Delete a subscription. Returns {subscription, dropped}
Delete a subscription. Returns {subscription, dropped}
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects//subscriptions/ - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
subscription: The subscription: its name or its path projects/
admin
pubsub subscription_drop "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "orders-eu"
mentdb
{"subscription": "orders-eu", "dropped": true}
pubsub topic_drop <config> <topic>
Description
Delete a topic; its subscriptions stay, detached. Returns {topic, dropped}
Delete a topic; its subscriptions stay, detached. Returns {topic, dropped}
Parameters
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects//topics/ in the project of the configuration - String - required
config: The Google Cloud Pub/Sub configuration as JSON: project_id, and one of credentials_file (a service account key file in JSON: a signed JWT RS256 is exchanged for an OAuth token, kept until 5 minutes before its end; project_id comes from the file when absent), access_token (the name of a secret: secret set) or emulator_host (host:port of the local emulator, without authentication); url (https://pubsub.googleapis.com, or a regional endpoint), timeout_ms (30000, for each request), max_bytes (64 MB, the largest answer), ca_file (a PEM file of a private CA). A token over http is refused unless the host is localhost or 127.0.0.1 (the emulator never gets one) - String - required
topic: The topic: its name (3 to 255 characters, a letter first, not goog...) or its path projects/
admin
pubsub topic_drop "{\"emulator_host\": \"127.0.0.1:8085\", \"project_id\": \"demo-project\"}" "audit"
mentdb
{"topic": "audit", "dropped": true}
