--- url: "https://asyncapi.com/docs/reference/bindings/googlepubsub" titulek: "googlepubsub | AsyncAPI Initiative for event-driven APIs" h1: "googlepubsub" popis: "Google Cloud Pub/Sub Bindings This document defines how to describe Google Cloud Pub/Sub specific information with AsyncAPI. Version Current version is 0.2.0. Channel Binding Object The Chann" jazyk: "en" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 02:46:44" znaku: 6060 slov: 669 kodovani: "utf-8" sha256: "86ddc0280e621a34c098131fadf3027308ea8e9d436e69cac7faf719bca94b52" --- ##### On this page Google Cloud Pub/Sub Bindings Version Channel Binding Object Message Storage Policy Object Schema Settings Object Example Message Binding Object Schema Definition Object Example Operation Binding Object Server Binding Object # googlepubsub Found an error? Have a suggestion?[Edit this page on GitHub](https://github.com/asyncapi/bindings/tree/master/googlepubsub.md) # Google Cloud Pub/Sub Bindings This document defines how to describe Google Cloud Pub/Sub specific information with AsyncAPI. ## Version Current version is `0.2.0`. ## Channel Binding Object The `Channel Bindings Object` is used to describe the Google Cloud Pub/Sub specific [Topic](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/create) details with AsyncAPI. | Field Name | Type | Description | | --- | --- | --- | | `bindingVersion` | String | The current version is `0.2.0` | | `labels` | Object | An object of key-value pairs *(These are used to categorize Cloud Resources like Cloud Pub/Sub Topics.)* | | `messageRetentionDuration` | String | Indicates the minimum duration to retain a message after it is published to the topic *(Must be a valid [Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration).)* | | `messageStoragePolicy` | Message Storage Policy Object | Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored | | `schemaSettings` | Schema Settings Object | Settings for validating messages published against a schema | ### Message Storage Policy Object The `Message Storage Policy Object` is used to describe the Google Cloud Pub/Sub [MessageStoragePolicy](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#MessageStoragePolicy) Object with AsyncAPI. | Field Name | Type | Description | | --- | --- | --- | | `allowedPersistenceRegions` | String[] | A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage | ### Schema Settings Object The `Schema Settings Object` is used to describe the Google Cloud Pub/Sub [SchemaSettings](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#SchemaSettings) Object with AsyncAPI. | Field Name | Type | Description | | --- | --- | --- | | `encoding` | String | The encoding of the message *(Must be one of the possible [Encoding](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#encoding) values.)* | | `firstRevisionId` | String | The minimum *(inclusive)* revision allowed for validating messages | | `lastRevisionId` | String | The maximum *(inclusive)* revision allowed for validating messages | | `name` | String | The name of the schema that messages published should be validated against *(The format is `projects/{project}/schemas/{schema}`.)* | ### Example ``` # ... channels: topic-avro-schema: address: projects/your-project/topics/topic-avro-schema bindings: googlepubsub: schemaSettings: encoding: json name: projects/your-project/schemas/message-avro # ... topic-proto-schema: address: projects/your-project/topics/topic-proto-schema bindings: googlepubsub: messageRetentionDuration: 86400s messageStoragePolicy: allowedPersistenceRegions: - us-central1 - us-central2 - us-east1 - us-east4 - us-east5 - us-east7 - us-south1 - us-west1 - us-west2 - us-west3 - us-west4 schemaSettings: encoding: binary name: projects/your-project/schemas/message-proto # ... ``` ## Message Binding Object The `Message Binding Object` is used to describe the Google Cloud Pub/Sub specific [PubsubMessage](https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage) details, alongside with pertintent parts of the Google Cloud Pub/Sub [Schema](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.schemas#Schema) Object, with AsyncAPI. | Field Name | Type | Description | | --- | --- | --- | | `bindingVersion` | String | The current version is `0.2.0` | | `attributes` | Object | Attributes for this message *(If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.)* | | `orderingKey` | String | If non-empty, identifies related messages for which publish order should be respected *(For more information, see [ordering messages](https://cloud.google.com/pubsub/docs/ordering).)* | | `schema` | Schema Definition Object | Describes the schema used to validate the payload of this message | ### Schema Definition Object The `Schema Definition Object` is used to describe the Google Cloud Pub/Sub [Schema](%5BSchema%5D(https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.schemas#Schema)) Object with AsyncAPI. While some of this information could be, or is, described using native AsyncAPI, for consistency it makes sense to provide this information here at all times, especially for cases where AsyncAPI does not natively support describing payloads using a supported Google Cloud Pub/Sub schema format like Protobuf. | Field Name | Type | Description | | --- | --- | --- | | `name` | String | The name of the schema | ### Example ``` # ... components: messages: messageAvro: bindings: googlepubsub: schema: name: projects/your-project/schemas/message-avro contentType: application/json name: MessageAvro payload: schema: fields: - name: message type: string name: Message type: record schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 messageProto: bindings: googlepubsub: schema: name: projects/your-project/schemas/message-proto contentType: application/octet-stream name: MessageProto payload: schema: | syntax = "proto3"; message Message { required string message = 1; } schemaFormat: application/vnd.google.protobuf;version=3 # ... ``` ## Operation Binding Object This object MUST NOT contain any properties. Its name is reserved for future use. ## Server Binding Object This object MUST NOT contain any properties. Its name is reserved for future use. [Go Backanypointmq](/docs/reference/bindings/anypointmq) [Up Nexthttp](/docs/reference/bindings/http) Was this helpful? Help us improve the docs by sharing your feedback. [Submit Feedback](https://github.com/asyncapi/website/issues/new?template=docs-feedback.yml&title=Docs%20Feedback%3A%20%2Fdocs%2Freference%2Fbindings%2Fgooglepubsub&labels=%F0%9F%93%91%20docs) OR [Create Issue on GitHub](https://github.com/asyncapi/website/issues/new/choose)