SyncCoordinatorDocumentation

DOCUMENTATION / ARCHITECTURE

Architecture

SyncCoordinator consists of Web, Worker, and a management database. Web manages configuration, Worker synchronizes business databases, and the management database keeps configuration and processing state.

OVERVIEW

System topology

Deploy SyncCoordinator separately from the business systems. Web manages configuration, Worker executes synchronization, and the management database stores configuration and processing state.

Business system ASQL Server / MySQL / PostgreSQLExisting application and tables
SynCo
WebConfigure · Manage
WorkerSync · Notify
Management DBConfig · State
Business system BSQL Server / MySQL / PostgreSQLExisting application and tables
Worker reads business database changes and applies them according to mappings and conflict policies.

Component responsibilities

Coordinator Web

Provides the management console and administrator authentication. It edits connections, rules, and mappings, and generates and verifies database deployment SQL. It does not execute synchronization.

Coordinator Worker

Loads configuration from the management database, reads changes, evaluates conflicts, and applies results. It also delivers webhooks and cleans retained management data.

Coordinator management database

Stores connections, rules, mappings, Checkpoints, Inbox state, Snapshots, conflict history, and the other state required to resume processing.

SYNC RULES AND MAPPING

Synchronization rules and mappings

A rule defines source, destination, direction, and conflict behavior. Mappings attached to the rule describe differences in tables, columns, and values.

DIRECTION

One-way and bidirectional

  • One-wayProcesses changes from the fixed source to the fixed destination.
  • BidirectionalReturns edits made at the destination to the original source for records first synchronized from that source.
  • Loop preventionTracks the origin and applied message IDs so SynCo does not resend its own updates.

MAPPING

Tables, columns, and values

  • Tables and keysSelect the schema, table, and key columns that identify a record at each end.
  • Columns and typesStore column pairs, nullability, string length, precision, and scale.
  • Value conversionConfigure code mappings, UTC normalization, explicit rounding or truncation, and direction-specific fixed values.

CONFLICTS AND NOTIFICATIONS

Conflicts and notifications

Worker evaluates conflicts and delivers external notifications. Decisions and delivery state remain in the management database and are visible in the console.

CONFLICT

When a conflict occurs

  1. DetectCompare the previous Snapshot, incoming value, and current destination value. A conflict exists when both sides changed the same field to different values.
  2. Apply policyUse the incoming value, keep the destination, hold for review, or invoke a configured merge policy.
  3. Resolve when neededHeld conflicts appear in the console. Worker verifies the destination again before applying a manual decision.

NOTIFICATION

Notification flow

  1. Store the eventConflict and failure events are written to the management database Outbox.
  2. Send a webhookWorker asynchronously delivers the event to configured webhook endpoints.
  3. Retry failuresFailed deliveries are retried with delay. Notification failure does not stop synchronization.

BUSINESS DATABASE BOUNDARY

Business database deployment

Add helper objects for change detection and duplicate-apply prevention. Existing application code, business tables, and business columns remain unchanged.

DEPLOYED OBJECTS

  • SyncChangeQueue
  • SyncAppliedMessage
  • SyncEntityOrigin
  • SyncDeleteTombstone
  • SyncCoordinatorDeployment
  • Change-detection triggers for mapped tables

UNCHANGED

  • Existing business applications
  • Existing business tables
  • Existing business columns

Saving configuration does not execute DDL. A DBA can review and run generated SQL, then verify the deployed definitions before enabling the rule.

Initial data: SyncCoordinator synchronizes changes made after deployment. Align existing data by another method before enabling synchronization.

STATE AND RELIABILITY

State and reliable execution

Business data remains in each business database. Synchronization configuration and processing state live in the Coordinator management database. Worker keeps no durable local state and resumes from saved state after a restart.

LocationMain statePurpose
Coordinator management DBSystems, rules, mappings, Checkpoints, Inbox, Snapshots, conflicts, audit, and operational historyThe source of truth for configuration and processing state.
Business DBBusiness rows, change Queue, applied messages, origin, delete tombstones, and deployment hashCurrent business data plus the helper state used for detection and idempotency.

Restart and redelivery

Checkpoint

Stores the last processed QueueId per source. A failed source does not advance.

Inbox and leases

Tracks Processing, Completed, Held, and Failed. Work interrupted by shutdown can be acquired again after its lease expires.

Idempotent apply

Records a deterministic delivery ID in SyncAppliedMessage so retrying the same delivery does not apply it twice.

SyncChangeQueue records that a row changed, not the changed value itself. On resume, Worker reads the row again and synchronizes its latest state.

IMPLEMENTATION DETAILS

Implementation details

Open the details that are relevant to implementation and production deployment.

Project dependency direction

Synchronization logic lives in Core. Web does not execute business database connectors; Worker invokes Core and performs synchronization.

Contracts ← Core ← Infrastructure ← Worker
                      ↑
                      └──────────── Web

ServiceDefaults ← Worker / Web
AppHost ─────────→ Worker / Web / demo resources
When configuration changes take effect
  1. Start cycleWorker creates a processing scope.
  2. Load connectionsIt reads enabled systems and protected connection data.
  3. SynchronizeConnections stay stable for that cycle.
  4. Next cycleSaved changes take effect without restarting Worker.
Encryption keys and database permissions
Protect connections

Business database connections and webhook secrets are encrypted with ASP.NET Core Data Protection.

Share the Key Ring

When Web and Worker use different accounts or hosts, give both access to a protected shared Key Ring.

Least privilege

Separate Worker read/write permissions from the DDL permission used to deploy helper objects.

NEXT

Read next

OverviewWorkflow