Skip to main content

Asset Event Architecture

Summary

The verified pipeline that carries an asset lifecycle change from an in-memory domain event to a published integration contract, including the components that are registered in the service host.

Audience

Engineering, integration, QA, architecture, and security reviewers.

Reference Content

Components

ComponentTypeRoleSource
AssetDomainEventBase and six recordsDomain eventRaised by the aggregate on transitionsDomain/Asset/AssetDomainEvents.cs
AggregateRootDomain primitiveHolds DomainEvents, Raise, ClearDomainEventsDomain/Common/DomainPrimitives.cs
AssetDbContext.DispatchDomainEventsToOutboxInfrastructureMaps domain events to contracts on saveInfrastructure/AssetDbContext.cs
IntegrationEventJsonSerializerShared kernelSerializes a contract into an outbox rowshared-kernel/Outbox/IntegrationEventJsonSerializer.cs
OutboxMessageShared kernelThe staged outbox rowshared-kernel/Outbox/OutboxMessage.cs
OutboxRelayHostedServiceHosted servicePolls the outbox every 10 secondsMessaging/OutboxRelayHostedService.cs
OutboxProcessorShared kernelPublishes pending/failed rowsshared-kernel/Messaging/OutboxProcessor.cs
RabbitMqEventBusShared kernelPublishes to the brokershared-kernel/Messaging/RabbitMqEventBus.cs

Host registration (verified)

Program.cs calls AddHrSuitMessaging(...), which registers the shared event bus, the integration-event publisher, and a scoped IOutboxProcessor that resolves to the real OutboxProcessor when an IOutboxMessageStore is present (asset-service registers AssetOutboxMessageStore). Program.cs also registers OutboxRelayHostedService as a hosted service. The relay resolves the processor in its own scope per iteration.

Pipeline

Design boundaries

  • The map and completeness guard run before commit; a gap throws and rolls back the whole change.
  • Publishing happens after commit, asynchronously, on the relay thread. A publish failure never blocks the request that wrote the row.
  • Broker reachability is environment-dependent. This documentation does not connect to messaging infrastructure and does not verify end-to-end broker delivery.

Source References

  • microservices/src/asset-service/Infrastructure/AssetDbContext.cs
  • microservices/src/asset-service/Messaging/OutboxRelayHostedService.cs
  • microservices/src/shared-kernel/Messaging/OutboxProcessor.cs
  • microservices/src/shared-kernel/Extensions/MessagingExtensions.cs
  • microservices/src/asset-service/Program.cs

See Also

Keywords

  • Event architecture
  • Outbox relay
  • Domain event dispatch

Revision Information

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