Skip to content

Commit ec7d81c

Browse files
committed
feat: add googlepubsub bindings
This commit contains two bindings, a `Channel Binding Object` and a `Message Binding Object` for Google Cloud Pub/Sub using the `googlepubsub` protocol name.
1 parent 0dcef46 commit ec7d81c

File tree

5 files changed

+242
-5
lines changed

5 files changed

+242
-5
lines changed

CODEOWNERS

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
* @derberg @fmvilas @asyncapi-bot-eve
1010

11-
/anypointmq/ @GeraldLoeffler
12-
/ibmmq/ @rcoppen
13-
/kafka/ @lbroudoux @dalelane
14-
/solace/ @damaru-inc @CameronRushton
15-
*.json @KhudaDad414
11+
/anypointmq/ @GeraldLoeffler
12+
/ibmmq/ @rcoppen
13+
/kafka/ @lbroudoux @dalelane
14+
/googlepubsub/ @whitlockjc
15+
/solace/ @damaru-inc @CameronRushton
16+
*.json @KhudaDad414

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This repository contains the specifications for each AsyncAPI protocol binding.
66

77
* [AMQP binding](./amqp)
88
* [AMQP 1.0 binding](./amqp1)
9+
* [Google Cloud Pub/Sub binding](./googlepubsub)
910
* [HTTP binding](./http)
1011
* [IBM MQ binding](./ibmmq)
1112
* [JMS binding](./jms)

googlepubsub/README.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Google Cloud Pub/Sub Bindings
2+
3+
This document defines how to describe Google Cloud Pub/Sub specific information with AsyncAPI.
4+
5+
<a name="version"></a>
6+
7+
## Version
8+
9+
Current version is `1.0.0`.
10+
11+
<a name="channel"></a>
12+
13+
## Channel Binding Object
14+
15+
The `Channel Bindings Object` is used to describe the Google Cloud Pub/Sub specific
16+
[Topic](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/create) details with AsyncAPI.
17+
18+
Field Name | Type | Description
19+
---|---|---
20+
`bindingVersion`|String|The current version is `1.0.0`
21+
`labels`|Object|An object of key-value pairs _(These are used to categorize Cloud Resources like Cloud Pub/Sub Topics.)_
22+
`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).)_
23+
`messageStoragePolicy`|[Message Storage Policy Object](#message-storage-policy-object)|Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored
24+
`schemaSettings`|[Schema Settings Object](#schema-settings-object)|Settings for validating messages published against a schema
25+
26+
<a name="message-storage-policy-object"></a>
27+
28+
### Message Storage Policy Object
29+
30+
The `Message Storage Policy Object` is used to describe the Google Cloud Pub/Sub
31+
[MessageStoragePolicy](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#MessageStoragePolicy)
32+
Object with AsyncAPI.
33+
34+
Field Name | Type | Description
35+
---|---|---
36+
`allowedPersistenceRegions`|String[]|A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage
37+
38+
<a name="schema-settings-object"></a>
39+
40+
### Schema Settings Object
41+
42+
The `Schema Settings Object` is used to describe the Google Cloud Pub/Sub
43+
[SchemaSettings](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#SchemaSettings) Object with
44+
AsyncAPI.
45+
46+
Field Name | Type | Description
47+
---|---|---
48+
`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.)_
49+
`firstRevisionId`|String|The minimum _(inclusive)_ revision allowed for validating messages
50+
`lastRevisionId`|String|The maximum _(inclusive)_ revision allowed for validating messages
51+
`name`|String|The name of the schema that messages published should be validated against _(Format is `projects/{project}/schemas/{schema}`.)_
52+
53+
<a name="message"></a>
54+
55+
## Message Binding Object
56+
57+
The `Message Binding Object` is used to describe the Google Cloud Pub/Sub specific
58+
[PubsubMessage](https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage) details, alongside with pertintent
59+
parts of the Google Cloud Pub/Sub
60+
[Schema](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.schemas#Schema)
61+
Object, with AsyncAPI.
62+
63+
Field Name | Type | Description
64+
---|---|---
65+
`bindingVersion`|String|The current version is `1.0.0`
66+
`attributes`|Object|An object of key-value pairs _(Attributes for this message.)_
67+
`orderingKey`|String|if non-empty, identifies related messages for which publish order should be respected
68+
`schema`|[Schema Definition Object](#schema-definition-object)|Describes the schema used to validate the payload of this message
69+
70+
<a name="schema-definition-object"></a>
71+
72+
### Schema Definition Object
73+
74+
The `Schema Definition Object` is used to describe the Google Cloud Pub/Sub
75+
[Schema]([Schema](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.schemas#Schema)) Object with AsyncAPI.
76+
While some of this information could be, or is, described using native AsyncAPI, for consistency it makes sense to
77+
provide this information here at all times, especially for cases where AsyncAPI does not natively support describing
78+
payloads using a supported Google Cloud Pub/Sub schema format like Protobuf.
79+
80+
Field Name | Type | Description
81+
---|---|---
82+
`definition`|String|The definition of the schema
83+
`name`|String|The name of the schema
84+
`type`|String|The type of the schema
85+
86+
<a name="operation"></a>
87+
88+
## Operation Binding Object
89+
90+
This object MUST NOT contain any properties. Its name is reserved for future use.
91+
92+
<a name="server"></a>
93+
94+
## Server Binding Object
95+
96+
This object MUST NOT contain any properties. Its name is reserved for future use.
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "http://asyncapi.com/bindings/amqp/channel.json",
4+
"title": "Cloud Pub/Sub Channel Schema",
5+
"description": "This object contains information about the channel representation for Google Cloud Pub/Sub.",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"patternProperties": {
9+
"^x-[\\w\\d\\.\\-\\_]+$": {
10+
"$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension"
11+
}
12+
},
13+
"properties": {
14+
"bindingVersion": {
15+
"type": "string",
16+
"enum": [
17+
"1.0.0"
18+
],
19+
"description": "The version of this binding."
20+
},
21+
"labels": {
22+
"type": "object"
23+
},
24+
"messageRetentionDuration": {
25+
"type": "string"
26+
},
27+
"messageStoragePolicy": {
28+
"type": "object",
29+
"additionalProperties": false,
30+
"properties": {
31+
"allowedPersistenceRegions": {
32+
"type": "array",
33+
"items": {
34+
"type": "string"
35+
}
36+
}
37+
}
38+
},
39+
"schemaSettings": {
40+
"type": "object",
41+
"additionalItems": false,
42+
"properties": {
43+
"encoding": {
44+
"type": "string"
45+
},
46+
"firstRevisionId": {
47+
"type": "string"
48+
},
49+
"lastRevisionId": {
50+
"type": "string"
51+
},
52+
"name": {
53+
"type": "string"
54+
}
55+
},
56+
"required": ["encoding", "name"]
57+
}
58+
},
59+
"required": ["schemaSettings"],
60+
"examples": [
61+
{
62+
"labels": {
63+
"label1": "value1",
64+
"label2": "value2"
65+
},
66+
"messageRetentionDuration": "7d",
67+
"messageStoragePolicy": {
68+
"allowedPersistenceRegions": [
69+
"us-central1",
70+
"us-east1"
71+
]
72+
},
73+
"schemaSettings": {
74+
"encoding": "avro",
75+
"schema": "projects/your-project-id/schemas/your-schema"
76+
}
77+
}
78+
]
79+
}
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "http://asyncapi.com/bindings/amqp/channel.json",
4+
"title": "Cloud Pub/Sub Channel Schema",
5+
"description": "This object contains information about the message representation for Google Cloud Pub/Sub.",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"patternProperties": {
9+
"^x-[\\w\\d\\.\\-\\_]+$": {
10+
"$ref": "https://raw.githubusercontent.com/asyncapi/asyncapi-node/v2.7.7/schemas/2.0.0.json#/definitions/specificationExtension"
11+
}
12+
},
13+
"properties": {
14+
"bindingVersion": {
15+
"type": "string",
16+
"enum": [
17+
"1.0.0"
18+
],
19+
"description": "The version of this binding."
20+
},
21+
"attributes": {
22+
"type": "object"
23+
},
24+
"orderingKey": {
25+
"type": "string"
26+
},
27+
"schema": {
28+
"type": "object",
29+
"additionalItems": false,
30+
"properties": {
31+
"definition": {
32+
"type": "string"
33+
},
34+
"name": {
35+
"type": "string"
36+
},
37+
"type": {
38+
"type": "string"
39+
}
40+
},
41+
"required": ["definition", "name", "type"]
42+
}
43+
},
44+
"examples": [
45+
{
46+
"schema": {
47+
"definition": "{\n \"type\" : \"record\",\n \"name\" : \"Message\",\n \"fields\" : [\n {\n \"name\" : \"message\",\n \"type\" : \"string\"\n }\n ]\n}\n",
48+
"name": "projects/your-project-id/schemas/your-avro-schema-id",
49+
"type": "avro"
50+
}
51+
},
52+
{
53+
"schema": {
54+
"definition": "syntax = \"proto2\";\n\nmessage Message {\n required string message = 1;\n}\n",
55+
"name": "projects/your-project-id/schemas/your-protobuf-schema-id",
56+
"type": "protobuf"
57+
}
58+
}
59+
]
60+
}

0 commit comments

Comments
 (0)