Recipes

Handle an existing Execution

Coexist with, restart, or reject against related active work.

v0.1.0-dev.2Intermediateusecase_forge
Open source reference

Handle an existing Execution

UseCaseExistingExecutionPolicy runs at processing and compares a new Entry with related active Executions.

PolicyEffect
coexistkeeps active work and starts or queues the new Entry according to Execution mode
restartrequests cancellation of related active work, waits for termination, then starts the new Entry
rejectNewpreserves active work and rejects the new Entry as activeConflict
dart
registerCommand<SynchronizeDocument>(
  _synchronize,
  instructions: const UseCaseInstructionOverrides(
    processing: UseCaseProcessingInstructionOverrides(
      existingExecutionPolicy: UseCaseExistingExecutionPolicy.rejectNew,
    ),
  ),
);

restart and rejectNew require an executionKey. Cancellation is cooperative: the handler must await cancellable operations or check the context signal. A processing rejection does not become history; a restarted active Execution finishes as cancelled and does.

Use coexist for independent overlap, restart when only the latest active result remains relevant, and rejectNew when the running operation owns the resource.

ARKTELOS

Purpose-built engineering systems for software that has to hold.