Mozart.ProcessEngine (Mozart v1.0.1)
A ProcessEngine is dynamically spawned for the purpose of executing a top level process model defined by defprocess function (macro) call. Subprocess tasks do not result in the spawning of a new ProcessEngine instance. Instead, subprocess tasks are handled by pushing an execution frame upon the execution frame stack.
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.
Retrieves all completed tasks for a process instance.
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
execute(ppid)
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.
get_completed_tasks(ppid)
Retrieves all completed tasks for a process instance.
get_open_tasks(ppid)
Gets the open tasks of the given process engine. Useful for debugging.
get_state(ppid)
Returns the state of the process. Useful for debugging.
start_process(process, data, business_key \\ 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 business_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, business_key}
where:
- ppid is the Elixir pid for the spawned GenServer.
- uid is a uniquie identifier for a process execution.
- business_key is a unique identifier for a hierarchial process execution.
Sample invocation:
{:ok, ppid, uid, business_key} = ProcessEngine.start_process("a process model name", )