Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Relay API

Functions for managing relay pipeline configurations. All live in the tide schema.


tide.relay_set_outbox_v2

Configure a forward relay pipeline (outbox → external sink). Takes a single JSONB config object. The positional relay_set_outbox(...) form was removed in v0.36.0.

SELECT tide.relay_set_outbox_v2(config JSONB);
Config keyTypeDefaultDescription
nameTEXT(required)Unique pipeline name
outboxTEXT(required)Source outbox name (must already exist)
sink_typeTEXT(required)Sink type: inbox, nats, kafka, webhook, stdout, or file
configJSONB{}Sink-specific configuration
wire_formatTEXTnativenative or cloudevents
batch_sizeINT100Messages per relay batch
enabledBOOLEANtrueWhether the pipeline is active

The relay always polls the canonical tide.tide_outbox_messages table.

Upsert behavior: If a pipeline with the same name exists, its configuration is updated.

Example:

SELECT tide.relay_set_outbox_v2(
  jsonb_build_object(
    'name', 'orders-to-nats',
    'outbox', 'orders',
    'sink_type', 'nats',
    'config', jsonb_build_object(
      'url', 'tls://nats.example:4222',
      'subject_template', 'orders.{event_type}'
    ),
    'batch_size', 200
  )
);

tide.relay_enable

Enable a previously disabled pipeline.

SELECT tide.relay_enable(p_name TEXT);

Fires pg_notify('tide_relay_config', name) to trigger hot-reload in the relay.


tide.relay_disable

Disable a pipeline (stops processing without deleting config).

SELECT tide.relay_disable(p_name TEXT);

tide.relay_delete

Permanently delete a pipeline configuration.

SELECT tide.relay_delete(p_name TEXT);

tide.relay_get_config

Retrieve the full configuration for a pipeline.

SELECT tide.relay_get_config(p_name TEXT) → JSONB

Returns the stored config JSONB for the named pipeline.


tide.relay_list_configs

List all configured relay pipelines.

SELECT tide.relay_list_configs() → JSONB

Returns a JSON array of all pipelines with their direction and enabled status:

[
  {"name": "orders-to-nats", "direction": "outbox", "enabled": true},
  {"name": "webhooks-in", "direction": "inbox", "enabled": true}
]