Skip to main content

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

ComponentDuplicate behaviorStaleness/ordering behaviorSource
Leave outboxUnique integration EventIdOldest-first polling by occurrence time; no global stream orderingmicroservices/src/leave-service/Infrastructure/LeaveDbContext.cs
EmployeeProfile consumerCompares last profile EventIdIgnores event older than stored occurrence timemicroservices/src/leave-service/Messaging/EmployeeProfileConsumer.cs
Payroll consumerProcessed-event ledger by EventIdPer-snapshot last occurrence guardmicroservices/src/payroll-service/Messaging/PayrollReadModelConsumer.cs
Notification consumerProcessed-event ledger by EventIdConfigurable age-based stale handlingmicroservices/src/notification-service/Application/NotificationDispatcher.cs
Integration ServiceProcessed ledger and durable failure modelDoes not subscribe to Leave eventsmicroservices/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

See Also

Keywords

  • Idempotency
  • Event ordering
  • Staleness

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-15
  • Review cycle: Quarterly