Mozart.ProcessEngine (Mozart v0.3.7)

A ProcessEngine is dynamically spawned for the purpose of executing a process model defined by defprocess function call.

Summary

Functions

Used to complete any "complete-able" open tasks. Task execution frequently spawns new open tasks. Execute will continue to called recursively as long as there are "complete-able" open tasks.

Gets the open tasks of the given process engine. Useful for debugging.

Returns the state of the process. Useful for debugging.

Use this function to create a ProcessEngine instance initialized with the name of the process model to be executed and any initialization data. The engine will start executing tasks when the execute/1 function is called.

Functions

Used to complete any "complete-able" open tasks. Task execution frequently spawns new open tasks. Execute will continue to called recursively as long as there are "complete-able" open tasks.

Link to this function

get_open_tasks(ppid)

Gets the open tasks of the given process engine. Useful for debugging.

Link to this function

get_state(ppid)

Returns the state of the process. Useful for debugging.

Link to this function

start_process(model_name, data, process_key \\ nil, parent_pid \\ nil)

Use this function to create a ProcessEngine instance initialized with the name of the process model to be executed and any initialization data. The engine will start executing tasks when the execute/1 function is called.

Arguments are a process model name, initial process data, an optional process_key, and a parent process pid if there is a parent. If a process key is not specified, one will be assigned.

Returns a tuple of the form:

{:ok, ppid, uid, process_key}

where:

  • ppid is the Elixir pid for the spawned GenServer.
  • uid is a uniquie identifier for a process execution.
  • process_key is a unique identifier for a hierarchial process execution.

Sample invocation:

{:ok, ppid, uid, process_key} = ProcessEngine.start_process("a process model name", )