Documentation Index
Fetch the complete documentation index at: https://docs.goldsky.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Publish processed pipeline data to Google Cloud Pub/Sub topics for fan-out to downstream consumers, event-driven architectures, and decoupled integrations. Each row emitted by the upstream transform is serialized as a JSON object and delivered as the body of a single Pub/Sub message.The Pub/Sub sink is only available on Turbo pipelines.
Configuration
Parameters
Must be
pubsub.The transform or source to read data from.
The Pub/Sub topic to publish to. The topic must already exist in the GCP project referenced by the secret — the sink does not create topics. Specify the short topic id (for example
my-topic), not the fully-qualified projects/.../topics/... name.Name of the Goldsky secret (type
pubsub) containing the GCP project id and service-account credentials. See Secret format below.Maximum number of messages to batch before publishing.
Maximum time to wait before flushing a batch. Accepts humantime durations such as
100ms, 1s, or 500ms.Optional human-readable description for the sink.
Secret format
Create a Pub/Sub secret with the Goldsky CLI. You will be prompted for the GCP project id and the contents of a service-account JSON key file:projectId: the GCP project that owns the destination topic (for examplegoldsky-prod).credentialsJson: the raw contents of a GCP service-account JSON key file, on a single line. The CLI validates that the value parses as JSON and thattypeisservice_account.
IAM permissions
The service account referenced bycredentialsJson must have the following IAM roles in the destination project:
roles/pubsub.publisher— required to publish messages to the topic.roles/pubsub.viewer— required for the sink’s topic-existence pre-check that runs during pipeline initialization.
pubsub.topics.publish and pubsub.topics.get.
Message format
Each row emitted by the upstream transform becomes the data payload of a single Pub/Sub message, serialized as a JSON object. For example, a row with columnsid, from, and value is delivered as:
Example
Stream high-value ERC-20 transfers to a Pub/Sub topic for downstream fan-out:Best practices
Create the topic before starting the pipeline
Create the topic before starting the pipeline
The sink performs a topic-existence check during initialization and will fail to start if the topic does not exist. Create the topic in advance with
gcloud pubsub topics create my-topic or via Terraform.Scope service-account permissions tightly
Scope service-account permissions tightly
Grant the service account
roles/pubsub.publisher and roles/pubsub.viewer only on the specific topic (or the project that contains it) — not on the whole organization. Rotate the JSON key periodically.Stay within the 10 MB message size limit
Stay within the 10 MB message size limit
Pub/Sub rejects messages larger than 10 MB. Use an upstream SQL transform to drop or truncate large columns if your row payloads approach this limit.
Provision subscriptions for each consumer
Provision subscriptions for each consumer
Pub/Sub fans out to subscriptions, not directly to subscribers. Create one subscription per downstream consumer so they receive independent copies of the stream.