feat(workflow): escalation drain loop reassigns then completes (S-14, refs #15)
Implement BeoordelingEscalatieProcessor.PumpOnceAsync over the escalation client. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,24 @@ public sealed class BeoordelingEscalatieProcessor(
|
||||
ILogger<BeoordelingEscalatieProcessor> logger)
|
||||
{
|
||||
/// <summary>Acquire and process up to <paramref name="maxJobs"/> escalations. Returns the number acquired.</summary>
|
||||
public Task<int> PumpOnceAsync(int maxJobs, CancellationToken ct = default)
|
||||
=> throw new NotImplementedException();
|
||||
public async Task<int> PumpOnceAsync(int maxJobs, CancellationToken ct = default)
|
||||
{
|
||||
var jobs = await client.AcquireBeoordelingEscalatieJobsAsync(maxJobs, ct);
|
||||
|
||||
foreach (var job in jobs)
|
||||
{
|
||||
try
|
||||
{
|
||||
await client.ReassignBeoordelingToTeamleadAsync(job.ProcessInstanceId, ct);
|
||||
await client.CompleteBeoordelingEscalatieJobAsync(job.JobId, ct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Leave the job un-completed: its lock expires and Flowable redelivers it (§8.6).
|
||||
logger.LogError(ex, "BeoordelingEscaleren job {JobId} failed; leaving it for redelivery.", job.JobId);
|
||||
}
|
||||
}
|
||||
|
||||
return jobs.Count;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user