All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nflow.engine.workflow.definition.WorkflowState Maven / Gradle / Ivy

There is a newer version: 10.0.0
Show newest version
package io.nflow.engine.workflow.definition;

/**
 * Provides access to the workflow state information.
 */
public interface WorkflowState {
  /**
   * Return the name of the workflow state.
   *
   * @return The name.
   */
  String name();

  /**
   * Return the workflow state type.
   *
   * @return The workflow state type.
   */
  WorkflowStateType getType();

  /**
   * Return the description of the workflow state. Default implementation returns {@link #name()}.
   *
   * @return The description.
   */
  default String getDescription() {
    return name();
  }

  /**
   * Return true if this state can be automatically retried after throwing an exception, or false if the workflow instance should
   * move directly to failure state. Default implementation returns true if the throwable class is not annotated with
   * {@code @NonRetryable}.
   *
   * @param thrown
   *          The thrown exception.
   * @return True if the state can be retried.
   */
  default boolean isRetryAllowed(Throwable thrown) {
    return !thrown.getClass().isAnnotationPresent(NonRetryable.class);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy