feat(domain): implement the Flowable Workflow Client and ACL client (refs #6)
FlowableWorkflowClient speaks flowable-rest's REST API (Basic auth): start a registratie process with the registrationId variable, acquire OpenZaakAanmaken external-worker jobs and parse their registrationId, complete a job with the zaakUrl variable — the contract verified against a live engine. AclHttpClient POSTs the bsn to the ACL and returns the zaak URL. InMemoryRegistrationStore is a concurrent-dictionary upsert. OpenZaakJobProcessor drains parked jobs, opening a zaak per job and completing it, leaving failures for redelivery; OpenZaakJobPump is the hosted polling shell that drives it on an interval (ADR-0009). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Big.Application;
|
||||
|
||||
namespace Big.Infrastructure;
|
||||
@@ -9,9 +11,18 @@ namespace Big.Infrastructure;
|
||||
/// </summary>
|
||||
public sealed class AclHttpClient(HttpClient http, AclOptions options) : IAclClient
|
||||
{
|
||||
public Task<Uri> OpenZaakAsync(string bsn, CancellationToken ct = default)
|
||||
public async Task<Uri> OpenZaakAsync(string bsn, CancellationToken ct = default)
|
||||
{
|
||||
// STUB (red).
|
||||
return Task.FromResult(new Uri("about:blank"));
|
||||
using var response = await http.PostAsJsonAsync(
|
||||
new Uri(options.BaseUrl, "zaken"), new OpenZaakRequest(bsn), ct);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var opened = await response.Content.ReadFromJsonAsync<OpenZaakResponse>(ct)
|
||||
?? throw new InvalidOperationException("The ACL returned an empty zaak response.");
|
||||
return new Uri(opened.ZaakUrl);
|
||||
}
|
||||
|
||||
private sealed record OpenZaakRequest([property: JsonPropertyName("bsn")] string Bsn);
|
||||
|
||||
private sealed record OpenZaakResponse([property: JsonPropertyName("zaakUrl")] string ZaakUrl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user