Failing application-layer tests over fake ports (IWorkflowClient, IAclClient, IRegistrationStore): - Submit persists an INGEDIEND registration and starts the registratie process, recording the instance id — and persists *before* starting, so the worker can correlate the OpenZaakAanmaken job back to its aggregate (ADR-0009). - The worker opens a zaak via the ACL and attaches it; an unknown registration throws (job left for redelivery); a redelivered job is idempotent and opens no second zaak (§8.6). Handlers are stubs (no persistence / no ACL call) so the tests compile and fail on their assertions; the green commit implements them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
using Big.Domain;
|
|
|
|
namespace Big.Application;
|
|
|
|
/// <summary>A zorgprofessional's request to register, in domain language. No ZGW concepts.</summary>
|
|
public sealed record SubmitRegistrationCommand(string Bsn);
|
|
|
|
/// <summary>
|
|
/// The submit use case: create the <see cref="Registration"/> aggregate (INGEDIEND), persist it,
|
|
/// then start the registratie workflow process and record its instance id. It returns as soon as
|
|
/// the process is started — opening the zaak happens later, off the request path, in the external-task
|
|
/// worker (ADR-0009). Persisting <em>before</em> starting the process closes the race where the worker
|
|
/// acquires the OpenZaakAanmaken job before the aggregate it correlates to exists.
|
|
/// </summary>
|
|
public sealed class SubmitRegistration(IRegistrationStore store, IWorkflowClient workflow)
|
|
{
|
|
public async Task<RegistrationId> HandleAsync(SubmitRegistrationCommand command, CancellationToken ct = default)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(command);
|
|
|
|
// STUB (red): no persistence, no process start.
|
|
await Task.CompletedTask;
|
|
return RegistrationId.New();
|
|
}
|
|
}
|