View Source WorkflowMetal.Workitem.Workitem (workflow_metal v0.2.1)
A GenStateMachine
to run a workitem.
flow
Flow
The workitem starts to execute, when the workitem is created.
If the executor returns :started
,
you can call :complete
with the workitem_output
to complete the workitem manually(asynchronously).
If the executor returns {:completed, workitem_output}
,
the workitem is completed immediately.
The task can abandon the workitem when needed.
state
State
created+-------->started+------->completed
+ +
| |
| v
+---------->abandoned
restore
Restore
Restore itself only.
Link to this section Summary
Functions
Abandon a workitem.
Returns a specification to start this module under a supervisor.
Complete a workitem.
Link to this section Types
Specs
application() :: WorkflowMetal.Application.t()
Specs
case_id() :: WorkflowMetal.Storage.Schema.Case.id()
Specs
on_abandon() :: :ok
Specs
on_complete() :: :ok | {:error, :workitem_not_available}
Specs
options() :: [name: term(), workitem_schema: workitem_schema()]
Specs
t() :: %WorkflowMetal.Workitem.Workitem{ application: application() | nil, workitem_schema: workitem_schema() | nil }
Specs
transition_id() :: WorkflowMetal.Storage.Schema.Transition.id()
Specs
workflow_id() :: WorkflowMetal.Storage.Schema.Workflow.id()
Specs
workflow_identifier() :: WorkflowMetal.Workflow.Supervisor.workflow_identifier()
Specs
workitem_id() :: WorkflowMetal.Storage.Schema.Workitem.id()
Specs
workitem_output() :: WorkflowMetal.Storage.Schema.Workitem.output()
Specs
workitem_schema() :: WorkflowMetal.Storage.Schema.Workitem.t()
Link to this section Functions
Specs
abandon(:gen_statem.server_ref()) :: :ok
Abandon a workitem.
Returns a specification to start this module under a supervisor.
See Supervisor
.
Specs
complete(:gen_statem.server_ref(), workitem_output()) :: on_complete()
Complete a workitem.