Class AsiBackboneAuditCompletionPublisher
- Namespace
- ReferenceApplication.Web.Governance
- Assembly
- ReferenceApplication.Web.dll
Publishes NCAT audit-completion messages as AsiBackbone decision receipt lifecycle events.
public sealed class AsiBackboneAuditCompletionPublisher : IApplicationAuditCompletionPublisher
- Inheritance
-
AsiBackboneAuditCompletionPublisher
- Implements
- Inherited Members
Remarks
This is the host-owned form of AsiBackbone's optional NCAT audit-completion adapter. NCAT's completion outbox dispatches each committed mutation batch to the publisher registered for its destination. The publisher resolves the AsiBackbone audit ledger record named by the message's decision audit record identifier and appends a AsiBackbone.Core.Audit.DecisionReceiptLifecycleStage.GatewayExecutionCompleted lifecycle event that carries the mutation batch, record count, manifest hash, and persistence outcome. The decision and the mutation that it permitted are then linked in both directions.
Delivery is at least once. The lifecycle event identifier is derived from NCAT's idempotency key, so a redelivered message is recognized as a duplicate, and a different event under the same key is reported as a terminal conflict. A message whose decision record is not yet available is deferred rather than guessed.
A newly appended lifecycle event is projected onto telemetry through GovernanceTelemetryProjection. A duplicate, a deferral, or a failure projects nothing, and a projection can never change the delivery result.
Constructors
AsiBackboneAuditCompletionPublisher(IDbContextFactory<ApplicationDbContext>, ILoggerFactory, GovernanceEvidenceNotificationPublisher, GovernanceTelemetryProjection)
Initializes a new instance of the AsiBackboneAuditCompletionPublisher class.
public AsiBackboneAuditCompletionPublisher(IDbContextFactory<ApplicationDbContext> dbContextFactory, ILoggerFactory loggerFactory, GovernanceEvidenceNotificationPublisher notificationPublisher, GovernanceTelemetryProjection telemetryProjection)
Parameters
dbContextFactoryIDbContextFactory<ApplicationDbContext>The factory for short-lived application database contexts.
loggerFactoryILoggerFactoryThe logger factory used for the AsiBackbone EF Core stores.
notificationPublisherGovernanceEvidenceNotificationPublisherThe isolated best-effort evidence notification publisher.
telemetryProjectionGovernanceTelemetryProjectionThe best-effort projection of persisted evidence onto telemetry.
Fields
CompletionAdapterMetadataKey
The lifecycle metadata key that identifies the adapter that wrote the event.
public const string CompletionAdapterMetadataKey = "completionAdapter"
Field Value
CompletionEntryIdMetadataKey
The lifecycle metadata key that carries NCAT's completion idempotency key.
public const string CompletionEntryIdMetadataKey = "ncatCompletionEntryId"
Field Value
DestinationName
The NCAT audit-completion destination served by this publisher.
public const string DestinationName = "asibackbone"
Field Value
LifecycleEventIdPrefix
The prefix of deterministic lifecycle event identifiers.
public const string LifecycleEventIdPrefix = "ncat-completion-"
Field Value
PersistenceProviderName
The persistence provider label written to the lifecycle event.
public const string PersistenceProviderName = "NCAT"
Field Value
Properties
Destination
public string Destination { get; }
Property Value
Methods
CreateLifecycleEventId(string)
Creates the deterministic lifecycle event identifier for an NCAT completion idempotency key.
public static string CreateLifecycleEventId(string idempotencyKey)
Parameters
idempotencyKeystringThe NCAT completion idempotency key.
Returns
- string
The lifecycle event identifier.
PublishAsync(ApplicationAuditCompletionMessage, CancellationToken)
public ValueTask<ApplicationAuditCompletionPublishResult> PublishAsync(ApplicationAuditCompletionMessage message, CancellationToken cancellationToken = default)
Parameters
messageApplicationAuditCompletionMessagecancellationTokenCancellationToken