Interface Step

All Superinterfaces:
org.teavm.jso.JSObject

public interface Step extends org.teavm.jso.JSObject
The durable steps of a Workflow, which is the step argument of run.

Each call blocks the instance's fiber until the platform has the step's result. A step the platform has already finished returns its saved result and its body does not run, which is what makes a replay cheap. A body that throws fails the attempt, and the platform retries it according to the config.

Since:
1.0.3
  • Method Details

    • run

      default TSObject run(String name, Callable<TSObject> body)
      Runs a body as a durable step.

      The body runs on its own fiber, so it may call any binding. What it returns is stored, so it has to be a structured-cloneable value of at most 1 MiB.

      Parameters:
      name - the step's name; use the same one on every replay, at most 256 characters
      body - the work
      Returns:
      what the body returned
    • run

      default TSObject run(String name, TSObject config, Callable<TSObject> body)
      Runs a body as a durable step with retries and a timeout.
      Parameters:
      name - the step's name
      config - Cloudflare's step config, such as {"retries": {"limit": 3, "delay": "5 seconds"}, "timeout": "1 minute"}
      body - the work
      Returns:
      what the body returned
    • sleep

      default void sleep(String name, String duration)
      Sleeps without holding the instance.
      Parameters:
      name - the step's name
      duration - a duration the platform reads, such as "30 seconds" or "1 day"
    • doStep

      org.teavm.jso.core.JSPromise<TSObject> doStep(String name, Step.Body body)
    • doStep

      org.teavm.jso.core.JSPromise<TSObject> doStep(String name, TSObject config, Step.Body body)
    • doSleep

      org.teavm.jso.core.JSPromise<org.teavm.jso.JSObject> doSleep(String name, String duration)