Connectors / Streaming & queues

Google Cloud Pub/Sub

source

Google Cloud Pub/Sub consumer with ack at durable page boundaries

Install

cargo install faucet-cli --features source-pubsub
faucet init --source pubsub
# Cargo.toml — use it as a library
cargo add faucet-source-pubsub

Starter config

source:
  type: pubsub
  config:
    subscription: ""    # REQUIRED — Subscription id (short name, not the fully-qualified path).
    # project_id: ""    # GCP project id that owns the topic / subscription.
    # endpoint: ""    # Override the Pub/Sub API endpoint (host:port or URL).
    # emulator_host: ""    # Point the client at a Pub/Sub emulator (`host:port`).
    # credentials: { type: application_default }    # one of: application_default, service_account_json_file, service_account_json_inline, anonymous
      # --- Alternative variants — replace the block above with one of these ---
      # type: service_account_json_file
      # config:
        # path: ""    # REQUIRED
      #
      # type: service_account_json_inline
      # config:
        # json: ""    # REQUIRED
      #
      # type: anonymous
    # value_format: null    # How each message's `data` payload is decoded into the emitted `data` field.
    # attributes_key: "__attributes"    # JSON key the message attribute map is surfaced under.
    # max_messages_per_pull: 100    # Messages requested per `pull` RPC (1–1000).
    # idle_termination_secs: 0    # Stop after this many seconds without a new message.
    # max_messages: 0    # Stop after this many messages in total.
    # batch_size: 1000    # Records per emitted `StreamPage`.
    # on_decode_error: null    # What to do with a message whose payload does not decode under `value_format`.
    # ack_deadline_extension_secs: 60    # Ack deadline, in seconds, the source keeps renewing on every message it has pulled but not yet acked (while a page is assembled and while the sink writes it), so a slow page is not redelivered into the same run.

Capabilities

Replay Non-deterministic replay
Exactly-once replay No
Incremental No
Dataset discovery No
Reports lag No
Compression No

Config fields

FieldTypeDefaultDescription
subscription
required
string — Subscription id (short name, not the fully-qualified path). The client forms projects/<project>/subscriptions/<id> from the connection's project.
project_id string — GCP project id that owns the topic / subscription. Required for real Pub/Sub; the emulator infers it from PUBSUB_PROJECT_ID when unset.
endpoint string — Override the Pub/Sub API endpoint (host:port or URL). Rarely needed — prefer emulator_host for the emulator.
emulator_host string — Point the client at a Pub/Sub emulator (host:port). When set, auth is skipped and the endpoint is taken from this value — mirrors the PUBSUB_EMULATOR_HOST environment variable the SDK honours.
credentials object type: application_default How to authenticate. Defaults to Application Default Credentials.
value_format object json Payload decoding for the message data field.
attributes_key string __attributes JSON key the message attribute map is surfaced under. Default __attributes. Must differ from the record's own fields (data, message_id, ordering_key, publish_time_millis, decode_error).
max_messages_per_pull integer 100 Messages requested per pull RPC (1–1000). Default 100.
idle_termination_secs integer — Stop after this many seconds without a new message. At least one of idle_termination_secs and max_messages must be set (mirrors the Kafka / Kinesis sources) — a batch run must terminate.
max_messages integer — Stop after this many messages in total.
batch_size integer 1000 Records per emitted StreamPage. 0 is the "no batching" sentinel: one page per drain. Default 1000. A page's messages are acked once the pipeline has durably written the page.
on_decode_error object fail What to do with a message whose payload does not decode. Default fail.
ack_deadline_extension_secs integer 60 Ack deadline, in seconds, the source keeps renewing on every message it has pulled but not yet acked (while a page is assembled and while the sink writes it), so a slow page is not redelivered into the same run. Renewed every 5 s (or every third of the window, if shorter). 0 disables renewal. Range 10–600. Default 60.
Get started

Your first pipeline runs in five minutes.

Install the CLI, scaffold a config, and move real data — nothing external to stand up.

curl -LsSf https://github.com/faucet-hq/faucet-stream/releases/latest/download/faucet-cli-installer.sh | sh
brew install faucet-hq/faucet-stream/faucet-cli