Table of Contents

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

dbContextFactory IDbContextFactory<ApplicationDbContext>

The factory for short-lived application database contexts.

loggerFactory ILoggerFactory

The logger factory used for the AsiBackbone EF Core stores.

notificationPublisher GovernanceEvidenceNotificationPublisher

The isolated best-effort evidence notification publisher.

telemetryProjection GovernanceTelemetryProjection

The 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

string

CompletionEntryIdMetadataKey

The lifecycle metadata key that carries NCAT's completion idempotency key.

public const string CompletionEntryIdMetadataKey = "ncatCompletionEntryId"

Field Value

string

DestinationName

The NCAT audit-completion destination served by this publisher.

public const string DestinationName = "asibackbone"

Field Value

string

LifecycleEventIdPrefix

The prefix of deterministic lifecycle event identifiers.

public const string LifecycleEventIdPrefix = "ncat-completion-"

Field Value

string

PersistenceProviderName

The persistence provider label written to the lifecycle event.

public const string PersistenceProviderName = "NCAT"

Field Value

string

Properties

Destination

public string Destination { get; }

Property Value

string

Methods

CreateLifecycleEventId(string)

Creates the deterministic lifecycle event identifier for an NCAT completion idempotency key.

public static string CreateLifecycleEventId(string idempotencyKey)

Parameters

idempotencyKey string

The NCAT completion idempotency key.

Returns

string

The lifecycle event identifier.

PublishAsync(ApplicationAuditCompletionMessage, CancellationToken)

public ValueTask<ApplicationAuditCompletionPublishResult> PublishAsync(ApplicationAuditCompletionMessage message, CancellationToken cancellationToken = default)

Parameters

message ApplicationAuditCompletionMessage
cancellationToken CancellationToken

Returns

ValueTask<ApplicationAuditCompletionPublishResult>