If Apache Iggy is useful to you, give it a star on GitHubStar apache/iggy
Skip to Content
Apache Iggy
ConnectorsSinks
These docs describe the upcoming release. They follow the master branches of apache/iggy and apache/iggy-connectors. For the last release, read the 0.10 release docs, or select a version at the top of the sidebar.

ScopeDB Sink

Append Iggy messages to an existing ScopeDB table with mapped columns or raw payloads.

The ScopeDB sink appends Iggy messages to an existing ScopeDB table through the ScopeDB Rust SDK (scopedb-client). It never creates tables, alters schemas, or submits transformation statements. At startup, the connector reads the target table definition from the ScopeDB catalog and validates that the required writable columns exist with compatible types.

Configuration

Use the runtime setup from the sink guide. Build the plugin from the repository root:

cargo build --release -p iggy_connector_scopedb_sink

Save this connector configuration in the local provider directory:

type = "sink"
key = "scopedb"
enabled = true
version = 0
name = "ScopeDB sink"
path = "target/release/libiggy_connector_scopedb_sink"
verbose = false

[[streams]]
stream = "orders"
topics = ["events"]
schema = "json"
batch_length = 1000
consumer_group = "scopedb_sink_connector"

[plugin_config]
endpoint = "https://<workspace-endpoint>"
table = "events"
mode = "mapped"
include_metadata = true
include_headers = false

endpoint and table are required. Supply the API key with the IGGY_CONNECTORS_SINK_SCOPEDB_PLUGIN_CONFIG_API_KEY environment variable rather than storing it in the TOML file. The credentials need permission to read the target table definition and append rows. Endpoints with embedded credentials, query parameters, or fragments are rejected at startup.

OptionDefaultDescription
endpointrequiredScopeDB HTTP(S) endpoint without embedded credentials, query parameters, or fragments
tablerequiredExisting target table name
api_keynoneBearer API key, when required by the endpoint
databasescopedbTarget database
schemapublicTarget schema
modemappedWrite mode: mapped or raw
payload_columnpayloadDestination column name in raw mode
include_metadatatruePopulate the six Iggy metadata columns listed below
include_headersfalsePopulate iggy_headers, independently of include_metadata
batch_size100Maximum rows per append request (1..=200000); larger batches lose more valid rows per bad row
max_request_bytes8388608Maximum uncompressed NDJSON request size in bytes (1..=8388608); oversized rows are rejected locally
max_concurrent_requests1Concurrent append requests per batch (>= 1); values above 1 allow out-of-order request completion
max_retries3Total attempts per request including the first, clamped to 1..=3
retry_delay1sInitial exponential backoff duration (humantime string)
max_retry_delay30sMaximum backoff duration, including Retry-After (humantime string)
retry_ambiguousfalseAllow replaying transient ambiguous write outcomes (may produce duplicate rows)
timeout30sOverall startup deadline and per-attempt HTTP write timeout (must be greater than zero)
verbose_loggingfalseLog per-batch summaries at info instead of debug

Invalid duration strings fall back to their documented defaults with a warning, and reversed retry_delay / max_retry_delay values are swapped. Out-of-range request limits or a zero timeout fail startup. Restart the connector after changing the target table definition.

Write Modes

In mapped mode, Json, Text, and Proto payloads must represent JSON objects. Top-level keys are matched by name to writable table columns; unmatched fields and computed columns are ignored. When metadata or headers are enabled, those generated columns override payload fields with the same names.

In raw mode, the entire payload is written to payload_column, which must be a writable column and must not conflict with enabled metadata or header columns. The target column type determines how payloads are encoded:

  • binary: base64-encoded bytes from any payload type.
  • string: UTF-8 text (Text, Proto, serialized Json, or UTF-8 Raw / FlatBuffer / Avro bytes).
  • object: valid JSON object (Json, Text, Proto, or UTF-8 JSON Raw bytes).
  • any: any valid JSON value (Json, Text, Proto, or UTF-8 JSON Raw bytes).

Numeric values must fit within signed 64-bit integer or JSON floating-point range; store wider identifiers as strings.

Metadata and Headers

When include_metadata = true, the target table must include these six writable columns:

ColumnScopeDB typeValue
iggy_streamstringSource stream name
iggy_topicstringSource topic name
iggy_partition_iduint or intSource partition ID
iggy_offsetuint or intSource message offset
iggy_timestamptimestampMessage timestamp converted from microseconds to UTC RFC 3339
iggy_idstringFull decimal u128 message ID

When include_headers = true, the table also requires a writable iggy_headers column of type object or any. Header keys follow the SDK header naming convention, text and typed values are stored as strings, binary or non-UTF-8 values are encoded as {"data":"<base64>","iggy_header_encoding":"base64"}, and absent headers are written as an empty object.

The example below creates a new target ScopeDB table for mapped mode (with metadata and headers enabled) via the ScopeDB Catalog API. PUT replaces the entire table definition and clears omitted fields or columns; to update an existing table, GET the same URL first and apply the modified full definition (optionally setting If-Match to the returned ETag).

The scopedb, public, and events path segments (and JSON "name") must match the connector's database, schema, and table settings, or startup fails when fetching the table from the catalog:

export SCOPEDB_ENDPOINT="https://<workspace-endpoint>"
export SCOPEDB_API_KEY="<api-key>"

curl -X PUT "$SCOPEDB_ENDPOINT/v1/catalog/databases/scopedb/schemas/public/tables/events" \
  -H "Authorization: Bearer $SCOPEDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "events",
    "columns": [
      {"name": "id", "data_type": "int"},
      {"name": "event", "data_type": "string"},
      {"name": "iggy_stream", "data_type": "string"},
      {"name": "iggy_topic", "data_type": "string"},
      {"name": "iggy_partition_id", "data_type": "uint"},
      {"name": "iggy_offset", "data_type": "uint"},
      {"name": "iggy_timestamp", "data_type": "timestamp"},
      {"name": "iggy_id", "data_type": "string"},
      {"name": "iggy_headers", "data_type": "object"}
    ]
  }'

Delivery and Failure Handling

The ScopeDB sink uses the runtime's default at_most_once delivery guarantee, which commits consumer group offsets on poll before ScopeDB persists the batch. A failed batch is logged and not automatically redelivered, and a crash after offset commit can lose unpersisted messages. Setting [delivery] with guarantee = "at_least_once" fails startup. Keep include_metadata = true and deduplicate or reconcile downstream by (iggy_stream, iggy_topic, iggy_partition_id, iggy_offset).

Each consume() call waits for all split requests and retries to settle without buffering rows across calls. By default, only validated HTTP 429 admission refusals are retried with bounded exponential backoff and Retry-After. HTTP 5xx responses, lost responses, and invalid success counts have ambiguous outcomes and are not replayed unless retry_ambiguous = true. Client-side write timeouts are never replayed automatically.

A batch split across multiple requests can partially succeed, and local encoding or size validation drops invalid rows individually before sending. When ScopeDB rejects a row during ingest, modern ScopeDB reports a whole-request error without per-row indexes, failing that entire append request (up to batch_size rows, default 100). Under at_most_once delivery, valid sibling rows in that request are not redelivered, so a larger batch_size increases loss per bad row.

Only when an older server response supplies complete, atomic structured row errors does the connector drop the indexed invalid rows and resubmit the remaining rows from that request once without replaying successful sibling requests. Every locally rejected, failed, or unconfirmed row is logged with its stream, topic, partition, and offset. There is no dead-letter queue.

For full implementation details, header encoding rules, row-error recovery, and live verification steps, see the ScopeDB sink README.

On this page