Skip to main content

Messaging and Outbox

Summary

Payroll consumes workforce and approved-input events into local projections and writes outbound Payroll events to a transactional outbox.

Audience

Backend and frontend developers, QA and DevOps engineers, support and security engineers, and solution architects.

Overview

Payroll consumes workforce and approved-input events into local projections and writes outbound Payroll events to a transactional outbox.

Technical Detail

Inbound consumption

A hosted broker consumer subscribes to confirmed Employee, Attendance, Leave, and Expense event families. It manually acknowledges successful processing, requeues failed deliveries, updates Payroll-owned read models, and writes synchronization audit evidence.

Idempotency and staleness

Processed event identity prevents exact replay. Per-projection timestamps reject strictly older events. Equal-time ordering, poison-message handling, dead-letter policy, and long-term reconciliation Require confirmation.

Outbound events

Calculation, freeze, unfreeze, and payslip generation create contract events and serialize them into outbox records in the same save as domain changes. Correlation metadata is supported conceptually. Full event payloads are outside this technical section.

Relay maturity

The Shared Kernel provides an outbox processor and Payroll registers its store, but Payroll startup does not register a hosted relay or otherwise invoke processing. Automatic draining is therefore Requires confirmation; outbox persistence alone is confirmed. Delivery is at-least-once in intent, so consumers must remain idempotent.

Source References

  • microservices/src/payroll-service/Messaging/PayrollReadModelConsumer.cs
  • microservices/src/payroll-service/Application/PayrollCalculationService.cs
  • microservices/src/payroll-service/Application/PayrollOutputsService.cs
  • microservices/src/payroll-service/Infrastructure/PayrollDbContext.cs
  • microservices/src/payroll-service/Infrastructure/Persistence.cs
  • microservices/src/shared-kernel/Extensions/MessagingExtensions.cs
  • microservices/src/shared-kernel/Messaging/OutboxProcessor.cs
  • microservices/src/contracts/Events/PayrollCalculatedEvent.cs
  • microservices/src/contracts/Events/PayslipGeneratedEvent.cs

See Also

Keywords

  • Payroll Service
  • Messaging and Outbox
  • Technical architecture

Revision Information

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