feat(domain): implement SubmitRegistration and OpenZaakWorker (refs #6)
SubmitRegistration creates the aggregate, persists it, starts the registratie process via the Workflow Client, records the instance id and upserts. OpenZaakWorker loads the correlated registration, opens a zaak via the ACL, attaches it and saves; an unknown registration throws (job redelivered), and an already-opened zaak short- circuits without opening a second one (§8.6). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,8 +18,16 @@ public sealed class SubmitRegistration(IRegistrationStore store, IWorkflowClient
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(command);
|
||||
|
||||
// STUB (red): no persistence, no process start.
|
||||
await Task.CompletedTask;
|
||||
return RegistrationId.New();
|
||||
var registration = Registration.Submit(command.Bsn);
|
||||
|
||||
// Persist before starting the process so the worker can correlate the OpenZaakAanmaken
|
||||
// job back to an aggregate that already exists (ADR-0009).
|
||||
await store.SaveAsync(registration, ct);
|
||||
|
||||
var processInstanceId = await workflow.StartRegistrationProcessAsync(registration.Id, ct);
|
||||
registration.RecordProcessStarted(processInstanceId);
|
||||
await store.SaveAsync(registration, ct);
|
||||
|
||||
return registration.Id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user