Skip to content

Dynamic Conditions

Amit Kumar edited this page Nov 6, 2017 · 1 revision

This feature is developed to simulate decision based branching inside the workflow based on some attribute of the output of the event generated from a state. for example, if there is a fork from a state and the workflow only wishes to continue on one path and discard the other.

T1 -------> T2 ------> T3 ------> T4 -------> T5 -------> T9
             |                                             ^
              `--------> T6 ------> T7 -------> T8 --------/

To discard the certain path, next state can raise FluxCancelPathException, which Flux Runtime to cancel the branch the event is going to travel, until a join node encountered.

If task T6 throws this exception, the entire path from T6 until T9 is cancelled. T9 would be executed with the event emitted from task T5.

@Task(version = 1, retries = 2, timeout = 1000)
  public ExampleEvent T6(ExampleEvent event) {
  if(event.exampleProperty()) {
      throw new FluxCancelPathException();
   }
}

Clone this wiki locally