Bind the NRC hoofdObject, recognise a zaken/status/create notification, and key the projection on the zaak (hoofdObject) so the status updates the existing INGEDIEND row to INGESCHREVEN — without reading OpenZaak (§8.1). Retain the ZGW resource in the log (new column + migration) so a rebuild reproduces the approved status. Updates the acceptance fakes for the new IAclClient/IZaakGateway members. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
40 lines
2.1 KiB
C#
40 lines
2.1 KiB
C#
namespace EventSubscriber.Application;
|
|
|
|
/// <summary>
|
|
/// The durable log of notifications the subscriber has accepted. It is both the idempotency
|
|
/// guard (a replayed notification is recognised and dropped) and the rebuild source: the
|
|
/// projection is a derived artefact (PRD §8.4) regenerated by replaying this log, so a rebuild
|
|
/// needs no access to OpenZaak (CLAUDE.md §8.1). Implemented in Infrastructure over Postgres.
|
|
/// </summary>
|
|
public interface INotificationLog
|
|
{
|
|
/// <summary>
|
|
/// Record a notification. Returns <c>true</c> if it was newly recorded, <c>false</c> if an
|
|
/// entry with the same key already existed (a duplicate delivery). Must be atomic so that
|
|
/// concurrent duplicate deliveries cannot both observe <c>true</c>.
|
|
/// </summary>
|
|
Task<bool> TryRecordAsync(RecordedNotification notification, CancellationToken ct = default);
|
|
|
|
/// <summary>Every accepted notification, for rebuilding the projection.</summary>
|
|
Task<IReadOnlyList<RecordedNotification>> AllAsync(CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>A notification that has been accepted, retaining what a rebuild needs to recompute its
|
|
/// projection row — including the ZGW <c>resource</c>, which distinguishes a zaak-create (INGEDIEND)
|
|
/// from a status-set (INGESCHREVEN) so a rebuild reproduces the right status.</summary>
|
|
public sealed record RecordedNotification(string Key, string Actie, string ZaakId, string Resource);
|
|
|
|
/// <summary>The read projection store. Owned by the projection bounded context (ADR-0008); the
|
|
/// subscriber writes to it and the projection-api reads it.</summary>
|
|
public interface IProjectionStore
|
|
{
|
|
/// <summary>Insert or update the row for <see cref="RegisterEntry.Id"/>. Idempotent on the id.</summary>
|
|
Task UpsertAsync(RegisterEntry entry, CancellationToken ct = default);
|
|
|
|
/// <summary>Remove every row — the first step of a rebuild.</summary>
|
|
Task ClearAsync(CancellationToken ct = default);
|
|
|
|
/// <summary>Every projection row (used by tests and the rebuild verification).</summary>
|
|
Task<IReadOnlyList<RegisterEntry>> AllAsync(CancellationToken ct = default);
|
|
}
|