googlepubsub

Found an error? Have a suggestion?Edit this page on GitHub

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 details with AsyncAPI.

Field NameTypeDescription
bindingVersionStringThe current version is 0.2.0
labelsObjectAn object of key-value pairs (These are used to categorize Cloud Resources like Cloud Pub/Sub Topics.)
messageRetentionDurationStringIndicates the minimum duration to retain a message after it is published to the topic (Must be a valid Duration.)
messageStoragePolicyMessage Storage Policy ObjectPolicy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored
schemaSettingsSchema Settings ObjectSettings 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 Object with AsyncAPI.

Field NameTypeDescription
allowedPersistenceRegionsString[]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 Object with AsyncAPI.

Field NameTypeDescription
encodingStringThe encoding of the message (Must be one of the possible Encoding values.)
firstRevisionIdStringThe minimum (inclusive) revision allowed for validating messages
lastRevisionIdStringThe maximum (inclusive) revision allowed for validating messages
nameStringThe name of the schema that messages published should be validated against (The format is projects/{project}/schemas/{schema}.)

Example

1# ...
2channels:
3  topic-avro-schema:
4    address: projects/your-project/topics/topic-avro-schema
5    bindings:
6      googlepubsub:
7        schemaSettings:
8          encoding: json
9          name: projects/your-project/schemas/message-avro
10# ...
11  topic-proto-schema:
12    address: projects/your-project/topics/topic-proto-schema
13    bindings:
14      googlepubsub:
15        messageRetentionDuration: 86400s
16        messageStoragePolicy:
17          allowedPersistenceRegions:
18          - us-central1
19          - us-central2
20          - us-east1
21          - us-east4
22          - us-east5
23          - us-east7
24          - us-south1
25          - us-west1
26          - us-west2
27          - us-west3
28          - us-west4
29        schemaSettings:
30          encoding: binary
31          name: projects/your-project/schemas/message-proto
32# ...

Message Binding Object

The Message Binding Object is used to describe the Google Cloud Pub/Sub specific PubsubMessage details, alongside with pertintent parts of the Google Cloud Pub/Sub Schema Object, with AsyncAPI.

Field NameTypeDescription
bindingVersionStringThe current version is 0.2.0
attributesObjectAttributes 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.)
orderingKeyStringIf non-empty, identifies related messages for which publish order should be respected (For more information, see ordering messages.)
schemaSchema Definition ObjectDescribes 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 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 NameTypeDescription
nameStringThe name of the schema

Example

1# ...
2components:
3  messages:
4    messageAvro:
5      bindings:
6        googlepubsub:
7          schema:
8            name: projects/your-project/schemas/message-avro
9      contentType: application/json
10      name: MessageAvro
11      payload:
12        schema:
13          fields:
14          - name: message
15            type: string
16          name: Message
17          type: record
18        schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0
19    messageProto:
20      bindings:
21        googlepubsub:
22          schema:
23            name: projects/your-project/schemas/message-proto
24      contentType: application/octet-stream
25      name: MessageProto
26      payload:
27        schema: |
28          syntax = "proto3";
29
30          message Message {
31            required string message = 1;
32          }
33        schemaFormat: application/vnd.google.protobuf;version=3
34# ...

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.

Was this helpful?
Help us improve the docs by adding your contribution.
OR
Github:AsyncAPICreate Issue on GitHub