Documentation ¶
Index ¶
- type ActivatedJob
- type BpmnEngine
- type BpmnEngineState
- func (state *BpmnEngineState) AddTaskHandler(taskId string, handler func(job ActivatedJob))
- func (state *BpmnEngineState) CreateAndRunInstance(processKey int64, variableContext map[string]string) (*ProcessInstanceInfo, error)
- func (state *BpmnEngineState) CreateInstance(processKey int64, variableContext map[string]string) (*ProcessInstanceInfo, error)
- func (state *BpmnEngineState) FindProcessInstanceById(processInstanceKey int64) *ProcessInstanceInfo
- func (state *BpmnEngineState) GetMessageSubscriptions() []MessageSubscription
- func (state *BpmnEngineState) GetName() string
- func (state *BpmnEngineState) GetProcessInstances() []*ProcessInstanceInfo
- func (state *BpmnEngineState) LoadFromBytes(xmlData []byte) (*ProcessInfo, error)
- func (state *BpmnEngineState) LoadFromFile(filename string) (*ProcessInfo, error)
- func (state *BpmnEngineState) PublishEventForInstance(processInstanceKey int64, messageName string) error
- func (state *BpmnEngineState) RunOrContinueInstance(processInstanceKey int64) (*ProcessInstanceInfo, error)
- type CatchEvent
- type MessageSubscription
- type ProcessInfo
- type ProcessInstance
- type ProcessInstanceInfo
- func (pii *ProcessInstanceInfo) GetCreatedAt() time.Time
- func (pii *ProcessInstanceInfo) GetInstanceKey() int64
- func (pii *ProcessInstanceInfo) GetProcessInfo() *ProcessInfo
- func (pii *ProcessInstanceInfo) GetState() process_instance.State
- func (pii *ProcessInstanceInfo) GetVariable(key string) string
- func (pii *ProcessInstanceInfo) SetVariable(key string, value string)
- type Timer
- type TimerState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivatedJob ¶
type ActivatedJob struct { // the key, a unique identifier for the job Key int64 // the job's process instance key ProcessInstanceKey int64 // the bpmn process ID of the job process definition BpmnProcessId string // the version of the job process definition ProcessDefinitionVersion int32 // the key of the job process definition ProcessDefinitionKey int64 // the associated task element ID ElementId string // when the job was created CreatedAt time.Time // contains filtered or unexported fields }
ActivatedJob is a struct to provide information for registered task handler don't forget to call Fail or Complete when your task worker job is complete or not.
func (ActivatedJob) Complete ¶
func (activatedJob ActivatedJob) Complete()
Complete does set the state the worker successfully completing the job Fail and Complete mutual exclude each other
func (ActivatedJob) Fail ¶
func (activatedJob ActivatedJob) Fail(reason string)
Fail does set the state the worker missed completing the job Fail and Complete mutual exclude each other
func (ActivatedJob) GetVariable ¶
func (activatedJob ActivatedJob) GetVariable(key string) string
GetVariable from the process instance's variable context
func (ActivatedJob) SetVariable ¶
func (activatedJob ActivatedJob) SetVariable(key string, value string)
SetVariable to the process instance's variable context
type BpmnEngine ¶
type BpmnEngine interface { LoadFromFile(filename string) (*ProcessInfo, error) LoadFromBytes(xmlData []byte) (*ProcessInfo, error) AddTaskHandler(taskType string, handler func(job ActivatedJob)) CreateInstance(processKey int64, variableContext map[string]string) (*ProcessInstanceInfo, error) CreateAndRunInstance(processKey int64, variableContext map[string]string) (*ProcessInstanceInfo, error) RunOrContinueInstance(processInstanceKey int64) (*ProcessInstanceInfo, error) GetName() string GetProcessInstances() []*ProcessInstanceInfo FindProcessInstanceById(processInstanceKey int64) *ProcessInstanceInfo }
type BpmnEngineState ¶
type BpmnEngineState struct {
// contains filtered or unexported fields
}
func New ¶
func New(name string) BpmnEngineState
New creates an engine with an arbitrary name of the engine; useful in case you have multiple ones, in order to distinguish them.
func (*BpmnEngineState) AddTaskHandler ¶
func (state *BpmnEngineState) AddTaskHandler(taskId string, handler func(job ActivatedJob))
AddTaskHandler registers a handler function to be called for service tasks with a given taskId
func (*BpmnEngineState) CreateAndRunInstance ¶
func (state *BpmnEngineState) CreateAndRunInstance(processKey int64, variableContext map[string]string) (*ProcessInstanceInfo, error)
CreateAndRunInstance creates a new instance and executes it immediately. The provided variableContext can be nil or refers tp a variable map, which is provided to every service task handler function.
func (*BpmnEngineState) CreateInstance ¶
func (state *BpmnEngineState) CreateInstance(processKey int64, variableContext map[string]string) (*ProcessInstanceInfo, error)
CreateInstance creates a new instance for a process with given processKey
func (*BpmnEngineState) FindProcessInstanceById ¶
func (state *BpmnEngineState) FindProcessInstanceById(processInstanceKey int64) *ProcessInstanceInfo
FindProcessInstanceById searches for a give processInstanceKey and returns the corresponding ProcessInstanceInfo otherwise nil
func (*BpmnEngineState) GetMessageSubscriptions ¶
func (state *BpmnEngineState) GetMessageSubscriptions() []MessageSubscription
func (*BpmnEngineState) GetName ¶
func (state *BpmnEngineState) GetName() string
GetName returns the name of the engine, only useful in case you control multiple ones
func (*BpmnEngineState) GetProcessInstances ¶
func (state *BpmnEngineState) GetProcessInstances() []*ProcessInstanceInfo
GetProcessInstances returns a list of instance information.
func (*BpmnEngineState) LoadFromBytes ¶
func (state *BpmnEngineState) LoadFromBytes(xmlData []byte) (*ProcessInfo, error)
LoadFromBytes loads a given BPMN file by xmlData byte array into the engine and returns ProcessInfo details for the deployed workflow
func (*BpmnEngineState) LoadFromFile ¶
func (state *BpmnEngineState) LoadFromFile(filename string) (*ProcessInfo, error)
LoadFromFile loads a given BPMN file by filename into the engine and returns ProcessInfo details for the deployed workflow
func (*BpmnEngineState) PublishEventForInstance ¶
func (state *BpmnEngineState) PublishEventForInstance(processInstanceKey int64, messageName string) error
func (*BpmnEngineState) RunOrContinueInstance ¶
func (state *BpmnEngineState) RunOrContinueInstance(processInstanceKey int64) (*ProcessInstanceInfo, error)
RunOrContinueInstance runs or continues a process instance by a given processInstanceKey. returns the process instances, when found does nothing, if process is already in ProcessInstanceCompleted State returns nil, when no process instance was found Additionally, every time this method is called, former completed instances are 'garbage collected'.
type MessageSubscription ¶
type ProcessInfo ¶
type ProcessInfo struct { BpmnProcessId string // The ID as defined in the BPMN file Version int32 // A version of the process, default=1, incremented, when another process with the same ID is loaded ProcessKey int64 // The engines key for this given process with version // contains filtered or unexported fields }
type ProcessInstance ¶
type ProcessInstance interface { GetProcessInfo() *ProcessInfo GetInstanceKey() int64 GetVariable(key string) string SetVariable(key string, value string) GetCreatedAt() time.Time GetState() process_instance.State }
type ProcessInstanceInfo ¶
type ProcessInstanceInfo struct {
// contains filtered or unexported fields
}
func (*ProcessInstanceInfo) GetCreatedAt ¶
func (pii *ProcessInstanceInfo) GetCreatedAt() time.Time
func (*ProcessInstanceInfo) GetInstanceKey ¶
func (pii *ProcessInstanceInfo) GetInstanceKey() int64
func (*ProcessInstanceInfo) GetProcessInfo ¶
func (pii *ProcessInstanceInfo) GetProcessInfo() *ProcessInfo
func (*ProcessInstanceInfo) GetState ¶
func (pii *ProcessInstanceInfo) GetState() process_instance.State
GetState returns one of [ProcessInstanceReady,ProcessInstanceActive,ProcessInstanceCompleted]
┌─────┐ │Ready│ └──┬──┘
┌───▽──┐ │Active│ └───┬──┘ ┌────▽────┐ │Completed│ └─────────┘
func (*ProcessInstanceInfo) GetVariable ¶
func (pii *ProcessInstanceInfo) GetVariable(key string) string
func (*ProcessInstanceInfo) SetVariable ¶
func (pii *ProcessInstanceInfo) SetVariable(key string, value string)
type TimerState ¶
type TimerState string
const TimerCancelled TimerState = "CANCELLED"
const TimerCreated TimerState = "CREATED"
const TimerTriggered TimerState = "TRIGGERED"