Selecting Workflows

Some actions apply to a selection of workflow:

  • sending an event to workflows
  • pausing or resuming workflows
  • terminating workflows

Currently, there are 3 ways to select workflows:

Type selector value
by id"<id>")
by name"<name>")
by name and tag"<name>").withTag("<tag>")

This selector value should be used in requests below. For example:

const selector ="<name>").withTag("<tag>");

For example:

module.exports.handle = function* (...) {
  // select a workflow
  const selector ="<name>").withTag("<tag>");
  // send an event to it
  selector.send("<event name>", ...<event data>);
  // pause it
  yield selector.pause();
  // resume it
  yield selector.resume();
  // terminate it
  yield selector.terminate();

The ability for workflows to dispatch new workflows and to be able to communicate between them through events is a very powerful pattern, similar to the actor model.