Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 9d36f56

Browse files
committed
Document Google Cloud Pub/Sub source
1 parent b3b1dc5 commit 9d36f56

File tree

7 files changed

+101
-61
lines changed

7 files changed

+101
-61
lines changed
13.6 KB
Loading
40.7 KB
Loading
56.9 KB
Loading
25.5 KB
Loading

docs/sources/googlecloudpubsub.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Event Source for Google Cloud Pub/Sub
2+
3+
This event source subscribes to messages sent to a [Google Cloud Pub/Sub][gc-pubsub] topic.
4+
5+
## Prerequisites
6+
7+
### Service Account
8+
9+
A [Service Account][gc-pubsub-svcacc] is required to authenticate the event source and allow it to interact with Google
10+
Cloud Pub/Sub. You can create a service account by following the instructions at [Creating and managing service
11+
accounts][gc-iam-svcacc].
12+
13+
The service account must be granted an [IAM Role][gc-iam-roles] with at least the following permissions:
14+
15+
- `pubsub.subscriptions.consume`
16+
- `pubsub.subscriptions.get`
17+
18+
The following set of permissions is also required if you delegate the management of the Pub/Sub subscription to the
19+
event source. In case you prefer to manage the subscription yourself, these can be safely be omitted. More details on
20+
that topic are provided in the [Pub/Sub Subscription](#pubsub-subscription-optional) section below.
21+
22+
- `pubsub.subscriptions.create`
23+
- `pubsub.subscriptions.delete`
24+
25+
The predefined `roles/pubsub.editor` role is one example of role that is suitable for use with the TriggerMesh event
26+
source for Google Cloud Pub/Sub.
27+
28+
<!-- NOTE(antoineco): image from googlecloudstorage source purposely reused for simplicity -->
29+
![Service account](../images/googlecloudstorage-source/iam-1.png)
30+
31+
Create a [key in JSON format][gc-iam-key] for this service account and save it. This key is required to be able to run
32+
an instance of the Google Cloud Pub/Sub event source.
33+
34+
### Pub/Sub Topic
35+
36+
If you don't already have a Pub/Sub topic to subscribe to, create one by following the instructions at [Managing topics
37+
and subscriptions][gc-pubsub-adm].
38+
39+
Take note of the full [topic name][gc-pubsub-resname], it is a required input to be able to run an instance of the
40+
Google Cloud Pub/Sub event source.
41+
42+
<!-- NOTE(antoineco): image from googlecloudstorage source purposely reused for simplicity -->
43+
![Topic](../images/googlecloudstorage-source/topic-1.png)
44+
45+
### Pub/Sub Subscription _(optional)_
46+
47+
A subscription is required in order to allow the TriggerMesh event source for Google Cloud Pub/Sub to pull messages
48+
from a Pub/Sub topic.
49+
50+
This section can be skipped if you would like to let the event source manage its own subscription, which is the default
51+
behaviour. In this case, please simply ensure you granted all necessary permissions to the service account in the
52+
previous section.
53+
54+
If, however, you prefer messages to be pulled using a subscription which you manage yourself, please ensure that
55+
subscription is a "pull" subscription as described in the documentation page [Managing topics and
56+
subscriptions][gc-pubsub-adm].
57+
58+
<!-- NOTE(antoineco): image from googlecloudstorage source purposely reused for simplicity -->
59+
![Subscription](../images/googlecloudstorage-source/subscription-1.png)
60+
61+
## Deploying an Instance of the Source
62+
63+
Open the Bridge creation screen and add a source of type `Google Cloud Pub/Sub`.
64+
65+
![Adding a Google Cloud Pub/Sub source](../images/googlecloudpubsub-source/create-bridge-1.png)
66+
67+
In the Source creation form, give a name to the event source and add the following information:
68+
69+
* [**Secret**][gc-iam-key]: Service account key in JSON format, as described in the previous sections.
70+
* [**Topic**][gc-pubsub-resname]: Full resource name of the Pub/Sub topic to subscribe to.
71+
* **Subscription ID**: _(optional)_ ID of the subscription to use for pulling messages from the Pub/Sub topic, in case
72+
you prefer to manage this subscription yourself as described in the previous sections.
73+
74+
![Google Cloud Pub/Sub source form](../images/googlecloudpubsub-source/create-bridge-2.png)
75+
76+
After clicking the `Save` button, you will be taken back to the Bridge editor. Proceed to adding the remaining
77+
components to the Bridge, then submit it.
78+
79+
![Bridge overview](../images/googlecloudpubsub-source/create-bridge-3.png)
80+
81+
A ready status on the main _Bridges_ page indicates that the event source is ready to consume messages from the Pub/Sub
82+
topic.
83+
84+
![Bridge status](../images/googlecloudpubsub-source/create-bridge-4.png)
85+
86+
## Event Types
87+
88+
The TriggerMesh event source for Google Cloud Pub/Sub emits events of the following type:
89+
90+
* `com.google.cloud.pubsub.message`
91+
92+
[gc-pubsub]: https://cloud.google.com/pubsub
93+
[gc-pubsub-svcacc]: https://cloud.google.com/pubsub/docs/authentication#service-accounts
94+
[gc-pubsub-adm]: https://cloud.google.com/pubsub/docs/admin
95+
[gc-pubsub-resname]: https://cloud.google.com/pubsub/docs/admin#resource_names
96+
[gc-iam-svcacc]: https://cloud.google.com/iam/docs/creating-managing-service-accounts
97+
[gc-iam-key]: https://cloud.google.com/iam/docs/creating-managing-service-account-keys
98+
[gc-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles

docs/sources/googlepubsub.md

Lines changed: 0 additions & 59 deletions
This file was deleted.

docs/sources/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ solutions on our Cloud.
1616
* [AWS S3](./awss3.md): Subscribe to event notifications from an Amazon S3 bucket.
1717
* [AWS SNS](./awssns.md): Subscribe to messages from a AWS SNS topic.
1818
* [AWS SQS](./awssqs.md): Capture messages from an AWS SQS queue.
19+
* Google Cloud
20+
* [Google Cloud Pub/Sub](./googlecloudpubsub.md): Receive messages from a Google Cloud Pub/Sub topic.
21+
* [Google Cloud Storage](./googlecloudstorage.md): Capture change notifications from a Google Cloud Storage bucket.
1922
* [Webhook](./webhook.md): Generic Webhook integration.
20-
* [Google Cloud Storage](./googlecloudstorage.md): Capture change notifications from a Google Cloud Storage bucket.
2123
* [HTTP Poller](./httppoller.md): Generic HTTP Poller.
2224
* [OCIMetrics](./ocimetrics.md): Oracle Cloud Infrastructure Metrics
2325
* [Salesforce](./salesforce.md): Consume messages from Salesforce Streaming API.
@@ -39,7 +41,6 @@ azureeventhub
3941
azurestoragequeue
4042
4143
googlefirestore
42-
googlepubsub
4344
4445
mq
4546

0 commit comments

Comments
 (0)