Status: Observed (in force). Reconstructed.

Context

Local state must stay aligned with the provider in both directions: employee enrolments need pushing out, and withdrawals need pulling back so payroll can recover them and the employer can be invoiced. The options are webhooks from the provider, on-demand sync, or polling.

Decision

Two BackgroundService workers, each polling on a 30-second Task.Delay:

Worker Direction Drives
EwaEmployeeSynchronizationService (118 lines) push EwaInitialization.IsSynchronized
EwaWithdrawalSynchronizationService (118 lines) pull EwaWithdrawal.IsSynchronized

Both follow the same shape: fetch the unsynchronised set → build a synchronisation model list → call the sync method → flip the flag. A manual Control/Ewa/Sync can force a run.

IsSynchronized is the entire contract between local mirror and provider.

Consequences

Good:

Bad / costs:

If revisited

  1. Exponential backoff on consecutive failures — the cheapest improvement.