Class WorkflowWaitService

java.lang.Object
com.axelor.workflow.exec.WorkflowWaitService
All Implemented Interfaces:
WorkflowCallerResumer, RecordWake

public class WorkflowWaitService extends Object implements WorkflowCallerResumer, RecordWake
Resumes parked runs and branches: timer waits on the scheduler's wake (resumeTimer(java.lang.Long)), condition waits when their record changes (resumeConditionWaitsForRecord(com.axelor.workflow.exec.RecordRef)), message waits on delivery, and a caller parked on a <call> when its child finishes (resumeCaller(com.axelor.meta.db.MetaWorkflowRun)). A conditional waiting -> running claim gives each run exactly one resumer.
  • Constructor Details

    • WorkflowWaitService

      public WorkflowWaitService()
  • Method Details

    • label

      public String label()
      Description copied from interface: RecordWake
      Names this source in the orchestrator's log when it fails.
      Specified by:
      label in interface RecordWake
    • wake

      public void wake(RecordRef record)
      Description copied from interface: RecordWake
      Re-check whatever this source watches for one record, resuming what has become due.
      Specified by:
      wake in interface RecordWake
    • resumeTimer

      public WorkflowResult resumeTimer(Long runId)
      Scheduler wake for a due wake time: claim the run and re-enter the parked node, which knows whether its own timer or a boundary came due. It re-parks when neither did.
    • resumeConditionWaitsForRecord

      public int resumeConditionWaitsForRecord(RecordRef record)
      Record-change wake: re-enter every condition wait parked on record. Returns how many runs were re-evaluated.
    • resumeCaller

      public WorkflowResult resumeCaller(MetaWorkflowRun child)
      Wake a run parked on a <call> now that its child has finished. The way back is the callerParkKey the caller wrote on the child; a failed child fails the caller. An escape branch has no caller park, so nothing is woken for it.
      Specified by:
      resumeCaller in interface WorkflowCallerResumer
    • moveRun

      public WorkflowResult moveRun(MetaWorkflowRun run, WorkflowPlan target, String node, Integer targetRevision)
      Move a parked run onto a node of another revision, as an operator chose: claim it, tear down what its park held, and enter the target as a fresh arrival that derives its own park.
      Parameters:
      targetRevision - re-pinned before the walk, so the walk reads the graph it moved onto
      Returns:
      skipped when the claim was lost to an approver or a due timer
    • moveBranch

      public WorkflowResult moveBranch(MetaWorkflowBranch branch, WorkflowPlan target, String node, Integer targetRevision)
      The same move for one branch of a split; its split and join are unchanged, so the target must be on a branch of the same split.
    • resumeMessageWaits

      public int resumeMessageWaits(String name, String key, MessageDelivery message)
      Wake every park subscribed to this message. The matching subscription says which trigger fired: its boundary, or the parked node's own when it names none. The same one-winner claim applies, so two deliveries cannot both resume one run.
      Parameters:
      key - the occurrence to match, or null for a signal, which matches only keyless subscriptions
      message - what each woken walk reads as message
      Returns:
      how many parks moved
    • resumeTimerToken

      public WorkflowResult resumeTimerToken(Long tokenId)
      Wake a branch whose timer is due; it walks to its join and the split decides what follows.