Class AllMatchCombinatorDelegate

java.lang.Object
io.axoniq.framework.workflow.runtime.execution.AllMatchCombinatorDelegate
All Implemented Interfaces:
AllMatchCombinator

@Internal public class AllMatchCombinatorDelegate extends Object implements AllMatchCombinator
Default implementation of AllMatchCombinator.
Since:
5.4.0
Author:
Stefan Dragisic
See Also:
  • Constructor Details

    • AllMatchCombinatorDelegate

      @Internal public AllMatchCombinatorDelegate(WorkflowExecution workflowExecution)
      Creates a new delegate backed by the given workflow state.
      Parameters:
      workflowExecution - the workflow executor.
  • Method Details

    • allMatch

      Description copied from interface: AllMatchCombinator
      Guard combinator — ensures all completed results match the given predicate. Short-circuits on the first non-match.

      Short-circuit (non-match found)

      When a completed result does not match the predicate, it becomes the "violator". The composite delegates all state queries to the violating result. Remaining results are not automatically cancelled — the caller is responsible for cancelling if desired.

      Success (all complete, all matched)

      When all results complete and all match the predicate: isSuccess()=true, result()=empty, isFailure()=false.

      Completion

      isCompleted() is non-blocking and returns true when any completed result does not match the predicate or when all results have reached a terminal state.

      Cancellation

      cancel() and cancel(reason) propagate to all results.

      Summary

      The structural inverse of .noneMatch(): succeeds when all match, but short-circuits on first non-match to avoid cascading errors.

      Comparison with other combinators

      CombinatorResolves whenCancels losers?
      allMatchAll complete and all match, or short-circuit on first non-matchNo
      anyMatchFirst predicate match, or all completeNo (by default)
      noneMatchAll complete without a match, or short-circuit on first matchNo (by default)

      Result categorization

      The returned CombinatorWorkflowStepResult provides matched() and unmatched() to access categorized sub-results. For allMatch(WorkflowStepResult::success, successStep, failingStep, slowStep) where successStep succeeded, failingStep failed (short-circuits), and slowStep is still running:

      • matched() → [successStep] — results that satisfied success()
      • unmatched() → [failingStep, slowStep] — all other results, including violators and not-yet-completed
      Specified by:
      allMatch in interface AllMatchCombinator
      Parameters:
      predicate - the predicate that all results should match.
      results - the step results to guard.
      Returns:
      a composite result which succeeds when all results match, or short-circuits on the first non-match.