Leave to Payroll Integration Events
Summary
Payroll directly subscribes to LeaveApproved, LeaveRejected, and LeaveCancelled and updates a Payroll-owned period snapshot.
Audience
Leave/Payroll developers, QA, architects, operations/support, and integration owners.
Concept
Payroll resolves employee/date/type/unit categories from the contract and maintains approved, rejected, and cancelled classifications in its own read model. Paid/unpaid classification is inferred from Leave-type text in consumer code; LeaveType metadata is not carried by these decision contracts. This boundary is Transitional and does not document Payroll formulas.
An EventId ledger suppresses successfully synchronized duplicates. Snapshot occurrence time guards older events. A stale/skipped result is audited but not added to the processed ledger. Consumer failures are negatively acknowledged and requeued. Payroll does not subscribe to LeaveRequested, LeaveBalanceUpdated, or LeaveEncashed.
The current consumer increments categories from each accepted decision event; reconciliation of approval followed by cancellation/rejection and full cross-event ordering requires explicit testing.
Source References
- microservices/src/payroll-service/Messaging/PayrollReadModelConsumer.cs
- microservices/src/payroll-service/Infrastructure/PayrollDbContext.cs
- microservices/src/contracts/Events/LeaveLifecycleEvents.cs
- microservices/src/leave-service/Infrastructure/LeaveDbContext.cs
Related Articles
See Also
Keywords
- Payroll read model
- Leave decision events
- Staleness guard
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly