Google Cloud Pub/Sub connector setup
Consumes messages from a Google Cloud Pub/Sub subscription and emits them to your dataset. This is a streaming connector (long-running consumption, not scheduled polling).
What you need first
| Requirement | Details |
|---|---|
| GCP project | Project containing the Pub/Sub subscription |
| Subscription | Existing subscription attached to your topic (create the subscription before deploying) |
| Service account | With permission to consume from that subscription |
| Message source | Publisher writing events to the topic (log forwarder, log router, custom app, etc.) |
1. Prepare Pub/Sub resources
- Open the Google Cloud Console and select your project.
- Go to Pub/Sub → Subscriptions.
- Create or identify the subscription Perpetual will consume. Note:
- Project ID
- Subscription ID (short name, not the full path)
- Confirm messages are arriving (check Messages metrics or pull a test message).
Service account and IAM
- Go to IAM & Admin → Service accounts → Create service account.
- Name it (e.g.
perpetual-pubsub-consumer). - Grant the service account Pub/Sub Subscriber (
roles/pubsub.subscriber) on the project, or only on the specific subscription for least privilege. - Create a JSON key for the service account (or copy the
private_keyandclient_emailfields). - Record the service account email.
2. Perpetual credential
- Log in to Perpetual. Open Settings from the user/org control at the bottom left of the sidebar (click your name → Settings), then go to Credentials → New Credential.
- Choose Text.
- Fill in:
| Field | Value |
|---|---|
| Name | Unique identifier using letters, digits, and underscores only (e.g. gcp_pubsub). |
| Allowed URL patterns | *.googleapis.com |
| Value | Service account private key PEM (the private_key field from the JSON key) |
- Save the credential.
3. Create the Google Cloud Pub/Sub connector
-
Go to Datasets → Connectors → Create Connector.
-
Select Google Cloud Pub/Sub.
-
Connector name: unique identifier (letters, numbers, underscores).
-
Configure:
- Service account private key: select the credential from step 2.
- Project ID: GCP project containing the subscription.
- Subscription ID: subscription name to pull from.
- Service account email: email of the service account (must match the private key).
- Max messages per batch (optional): cap messages per pull (default 10).
- Max bytes per batch (optional): cap total bytes per pull.
-
Check Deploy to start the streaming connector after save.
The connector pulls messages, emits JSON records (id, data, publishTime), flushes to Firehose, then acks messages only after a successful flush.
Operational notes
- Cross-project subscriptions: If the subscription lives in a different project than the topic, grant
roles/pubsub.subscriberin the subscription's project. - At-least-once delivery: Messages are acked after Firehose flush; failures nack for redelivery.
- Lag metric: Heartbeats report consumer lag based on
publishTime.