Interface Workflow

All Superinterfaces:
org.teavm.jso.JSObject

public interface Workflow extends org.teavm.jso.JSObject
A Workflows binding. Declared with workflow(), named WORKFLOW by default.

A workflow outlives the request that started it and survives a restart, so this binding starts one and asks after it rather than running it.

Since:
1.0.0
  • Method Details

    • start

      default Workflow.Instance start(TSObject params)
      Starts an instance, letting Cloudflare pick the id.
      Parameters:
      params - the workflow's input
      Returns:
      the new instance
    • start

      default Workflow.Instance start(String id, TSObject params)
      Starts an instance with an id of your own, which makes the call idempotent.
      Parameters:
      id - the instance id
      params - the workflow's input
      Returns:
      the new instance
    • instance

      default Workflow.Instance instance(String id)
      Looks up a running or finished instance.
      Parameters:
      id - the instance id
      Returns:
      the instance
    • createBatch

      default List<Workflow.Instance> createBatch(List<TSObject> instances)
      Starts up to 100 instances in one call, from the list form Cloudflare deprecates.

      An id that already exists, or that repeats inside the batch, is skipped without a word. Use createBatch(TSObject) to hear about those.

      Parameters:
      instances - one entry(java.lang.String, dev.gmitch215.bytebox.js.TSObject) per instance
      Returns:
      the instances that were created, in order
    • createBatch

      default Workflow.BatchResult createBatch(TSObject options)
      Starts up to 100 instances in one call, from the options form.

      The object is Cloudflare's own: {count, params, retention} to start that many instances with one input, or {instances: [...]} to give each its own. A bad entry throws before anything is created; an id that already exists is reported in Workflow.BatchResult.errors() and the rest are created.

      Parameters:
      options - the options object
      Returns:
      what was created and what was not
    • createBatch

      default Workflow.BatchResult createBatch(int count, TSObject params)
      Starts count instances that share one input.
      Parameters:
      count - how many, from 1 to 100
      params - the input every instance gets
      Returns:
      what was created and what was not
    • entry

      static TSObject entry(String id, TSObject params)
      Builds one entry of a batch.
      Parameters:
      id - the instance id
      params - the instance's input
      Returns:
      an entry for createBatch(List) or the instances of an options object
    • create

      org.teavm.jso.core.JSPromise<Workflow.Instance> create(TSObject options)
    • rawCreateBatch

      org.teavm.jso.core.JSPromise<TSObject> rawCreateBatch(TSObject batch)
    • fetchInstance

      org.teavm.jso.core.JSPromise<Workflow.Instance> fetchInstance(String id)