Leave Event Idempotency and Ordering
Summary
Event identity exists end to end, but duplicate/stale handling differs by consumer and no global ordering guarantee is implemented.
Audience
Developers, QA, architects, reliability owners, and support engineers.
Concept
| Component | Duplicate behavior | Staleness/ordering behavior | Source |
|---|---|---|---|
| Leave outbox | Unique integration EventId | Oldest-first polling by occurrence time; no global stream ordering | microservices/src/leave-service/Infrastructure/LeaveDbContext.cs |
| EmployeeProfile consumer | Compares last profile EventId | Ignores event older than stored occurrence time | microservices/src/leave-service/Messaging/EmployeeProfileConsumer.cs |
| Payroll consumer | Processed-event ledger by EventId | Per-snapshot last occurrence guard | microservices/src/payroll-service/Messaging/PayrollReadModelConsumer.cs |
| Notification consumer | Processed-event ledger by EventId | Configurable age-based stale handling | microservices/src/notification-service/Application/NotificationDispatcher.cs |
| Integration Service | Processed ledger and durable failure model | Does not subscribe to Leave events | microservices/src/integration-service/Domain/IntegrationEntities.cs |
Leave mapping creates a new integration identity rather than retaining the domain-event identity. Correlation is set by Leave mapping; causation is absent. Tenant/business references are contract fields, but no broker partition/order key guarantee is proven.
Decision and balance events can arise from separate saves. Publication retry and competing consumer timing can expose them independently. Consumer logic must not assume request, decision, and balance events arrive as one atomic ordered group. Employee projection’s last-event check is not a full processed-event ledger and may not suppress non-consecutive replay.
Source References
- microservices/src/leave-service/Infrastructure/LeaveDbContext.cs
- microservices/src/leave-service/Messaging/EmployeeProfileConsumer.cs
- microservices/src/payroll-service/Messaging/PayrollReadModelConsumer.cs
- microservices/src/notification-service/Application/NotificationDispatcher.cs
- microservices/src/integration-service/Domain/IntegrationEntities.cs
Related Articles
See Also
Keywords
- Idempotency
- Event ordering
- Staleness
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly