Skip to main content

CDC Sink: Configuration Reference (Client API)

CdcSinkConfiguration

The top-level configuration object for a CDC Sink task.

PropertyTypeRequiredDescription
NamestringUnique task name
ConnectionStringNamestringName of the SQL connection string (uses the existing SqlConnectionString type - the same as SQL ETL). The connection string's FactoryName determines the source database engine.
TablesList<CdcSinkTableConfig>Root table configurations (at least one required)
PostgresCdcSinkPostgresSettingsPostgreSQL-specific settings (slot and publication names)
SkipInitialLoadboolWhen true, skip the initial full-table scan and start streaming CDC changes immediately. Only applies on first startup - has no effect once the initial load has completed. Default: false
DisabledboolCreate the task paused (without deleting it). Default: false
MentorNodestringPreferred cluster node for execution
PinToMentorNodeboolPin the task to the mentor node. Default: false
TaskIdlongServer-assigned task ID. To update a task, pass the existing task ID to UpdateCdcSinkOperation(taskId, configuration); do not use this property as the update selector.

Supported FactoryName values (set on the connection string):

FactoryNameDatabase Engine
NpgsqlPostgreSQL
Microsoft.Data.SqlClientSQL Server
MySql.Data.MySqlClient or MySqlConnector.MySqlConnectorFactoryMySQL / MariaDB

CdcSinkPostgresSettings

PostgreSQL-specific settings. Assigned to CdcSinkConfiguration.Postgres.
Leave null for non-PostgreSQL connections.

PropertyTypeDescription
SlotNamestringName of the PostgreSQL logical replication slot. If omitted on creation, auto-generated as rvn_cdc_s_{taskId}. Immutable once set. Max 63 characters, alphanumeric and underscores only.
PublicationNamestringName of the PostgreSQL publication. If omitted on creation, auto-generated as rvn_cdc_p_{taskId} (note the _p_ prefix vs. the slot's _s_). Same immutability rules as SlotName.

Setting these explicitly is useful when a DBA pre-creates the slot and publication with human-readable names,
when migrating from a previous task and reusing an existing slot, or when running multiple environments with predictable names.

CdcSinkTableConfig

Configures a root table - one SQL table mapped to one RavenDB collection.

PropertyTypeRequiredDescription
CollectionNamestringRavenDB collection name (e.g., "Orders")
SourceTableNamestringSQL table name (e.g., "orders")
SourceTableSchemastringSQL schema name. Default is provider-specific: PostgreSQL "public", SQL Server "dbo", MySQL/MariaDB the database name from the connection string.
PrimaryKeyColumnsList<string>SQL columns used for document ID generation
ColumnsList<CdcColumnMapping>Column mappings - each entry defines a SQL column, its document property name, and how to store it
PatchstringJavaScript patch for INSERT and UPDATE
OnDeleteCdcSinkOnDeleteConfigDelete behavior. Default: delete document
EmbeddedTablesList<CdcSinkEmbeddedTableConfig>Nested table configurations
LinkedTablesList<CdcSinkLinkedTableConfig>Foreign key reference configurations
DisabledboolSkip this table. Default: false

CdcSinkEmbeddedTableConfig

Configures a table whose rows are embedded as nested objects within a parent document.

PropertyTypeRequiredDescription
SourceTableNamestringSQL table name
SourceTableSchemastringSQL schema name (provider-specific default)
PropertyNamestringProperty name in the parent document (e.g., "Lines")
TypeCdcSinkRelationTypeArray, Map, or Value
JoinColumnsList<string>FK columns referencing parent's PrimaryKeyColumns
PrimaryKeyColumnsList<string>PK columns for matching items on UPDATE/DELETE
ColumnsList<CdcColumnMapping>Column mappings
PatchstringJavaScript patch on parent document for INSERT/UPDATE
OnDeleteCdcSinkOnDeleteConfigDelete behavior for embedded items
CaseSensitiveKeysboolCase-sensitive PK matching. Default: false
EmbeddedTablesList<CdcSinkEmbeddedTableConfig>Nested embedded tables
LinkedTablesList<CdcSinkLinkedTableConfig>Linked tables within embedded items

CdcSinkLinkedTableConfig

Configures a foreign key reference that becomes a document ID in the parent document.

PropertyTypeRequiredDescription
SourceTableNamestringSQL table name of the referenced table
SourceTableSchemastringSQL schema name (provider-specific default)
PropertyNamestringProperty name in the parent document (e.g., "Customer")
LinkedCollectionNamestringTarget RavenDB collection for ID generation (e.g., "Customers")
JoinColumnsList<string>FK columns used to build the referenced document ID

CdcColumnMapping

A single column mapping entry within a Columns list.

PropertyTypeRequiredDescription
ColumnstringSQL column name (case-insensitive)
NamestringDocument property name (or attachment name when Type = Attachment)
TypeCdcColumnTypeHow to store the value. Default: Default

CdcColumnType

Controls how a SQL column value is stored in RavenDB.

ValueBehavior
DefaultStandard type conversion: int→long, numeric/decimal→decimal, real→float, double precision→double, date→DateOnly, timestamp→DateTime, uuid→string, varchar/text→string. SQL arrays→JSON arrays. JSON/JSONB stored as plain string.
JsonParses the string value as a native JSON value (object, array, string, number, boolean, etc.) in the document. Use for PostgreSQL json/jsonb or SQL Server nvarchar(max) with JSON content.
AttachmentStores the raw column value as a RavenDB attachment. byte[]→binary (application/octet-stream), string→UTF-8 text (text/plain; charset=utf-8), float[]/double[]→raw binary vector data (application/octet-stream), not JSON arrays. The Name field becomes the attachment name.

CdcSinkOnDeleteConfig

Controls how DELETE events are handled for a table or embedded table.

PropertyTypeDefaultDescription
PatchstringnullJavaScript patch that runs when a DELETE event arrives
IgnoreDeletesboolfalseWhen true, CDC Sink skips the automatic document delete or embedded-item removal. If Patch is set, the patch still runs.

Available patch variables for OnDelete:

  • this - the document (root or parent for embedded)
  • $row - all SQL columns from the DELETE event
  • $old - the previous stored document or embedded item before the DELETE event

Behavior matrix:

IgnoreDeletesPatchResult
falsenullNormal delete (default)
falsesetPatch runs, then delete proceeds
truenullDELETE discarded silently
truesetPatch runs, delete skipped

CdcSinkRelationType

Specifies the structure of embedded data in the document.

ValueDescription
ArrayOne-to-many: stored as a JSON array. Items matched by PK for UPDATE/DELETE
MapOne-to-many: stored as a JSON object keyed by PK value(s)
ValueMany-to-one: stored as a single embedded object