GCP Pub/Sub¶
Publish events to Google Cloud Pub/Sub.
Docker Image¶
Configuration¶
For Local Testing¶
Options¶
| Option | Type | Required | Default | Metadata Override | Description |
|---|---|---|---|---|---|
project_id |
string | Yes | - | No | GCP project ID |
topic |
string | Yes | - | No | Pub/Sub topic name |
emulator_host |
string | No | - | No | Emulator host for testing |
Authentication¶
The sink uses the default GCP credentials chain:
GOOGLE_APPLICATION_CREDENTIALSenvironment variable- Application Default Credentials (ADC)
- GCE metadata service (when running on GCP)
Emulator Support¶
For local testing with the Pub/Sub emulator:
-
Set
PUBSUB_EMULATOR_HOSTenvironment variable: -
Set
emulator_hostin config to enable auto-topic creation:
Dynamic Routing¶
Unlike other sinks, GCP Pub/Sub does not support dynamic topic routing via metadata. The topic must be specified in the sink configuration.
Example¶
Complete configuration:
stream:
id: 1
pg_connection:
host: localhost
port: 5432
name: mydb
username: postgres
password: postgres
tls:
enabled: false
batch:
max_size: 1000
max_fill_secs: 5
sink:
type: gcp-pubsub
project_id: my-gcp-project
topic: postgres-events
Messages are published as JSON-serialized payloads. The Pub/Sub client handles batching internally (default: 10ms, 100 messages, or 1MiB).