Documentation ¶
Index ¶
- Constants
- func WithEmbargo(embargo int) *publishEmbargoOption
- type AbortFunc
- type AbortType
- type CompleteActivityFunc
- type CompleteActivityProcessorFunc
- type CompleteJobProcessorFunc
- type EventProcessorFunc
- type LaunchFunc
- type MessageCompleteProcessorFunc
- type MessageProcessorFunc
- type NatsService
- func (s *NatsService) AwaitMsg(ctx context.Context, state *model.WorkflowState) error
- func (s *NatsService) CloseUserTask(ctx context.Context, trackingID string) error
- func (s *NatsService) Conn() common.NatsConn
- func (s *NatsService) CreateJob(ctx context.Context, job *model.WorkflowState) (string, error)
- func (s *NatsService) CreateProcessInstance(ctx context.Context, workflowInstanceID string, parentProcessID string, ...) (*model.ProcessInstance, error)
- func (s *NatsService) CreateWorkflowInstance(ctx context.Context, wfInstance *model.WorkflowInstance) (*model.WorkflowInstance, error)
- func (s *NatsService) DeleteJob(_ context.Context, trackingID string) error
- func (s *NatsService) DestroyProcessInstance(ctx context.Context, state *model.WorkflowState, pi *model.ProcessInstance, ...) error
- func (s *NatsService) GetElement(ctx context.Context, state *model.WorkflowState) (*model.Element, error)
- func (s *NatsService) GetGatewayInstance(ctx context.Context, gatewayInstanceID string) (*model.Gateway, error)
- func (s *NatsService) GetGatewayInstanceID(state *model.WorkflowState) (string, string, error)
- func (s *NatsService) GetJob(ctx context.Context, trackingID string) (*model.WorkflowState, error)
- func (s *NatsService) GetLatestVersion(ctx context.Context, workflowName string) (string, error)
- func (s *NatsService) GetMessageSenderRoutingKey(ctx context.Context, workflowName string, messageName string) (string, error)
- func (s *NatsService) GetOldState(ctx context.Context, id string) (*model.WorkflowState, error)
- func (s *NatsService) GetProcessInstance(ctx context.Context, processInstanceID string) (*model.ProcessInstance, error)
- func (s *NatsService) GetProcessInstanceStatus(ctx context.Context, id string) ([]*model.WorkflowState, error)
- func (s *NatsService) GetServiceTaskRoutingKey(ctx context.Context, taskName string) (string, error)
- func (s *NatsService) GetUserTaskIDs(ctx context.Context, owner string) (*model.UserTasks, error)
- func (s *NatsService) GetWorkflow(ctx context.Context, workflowID string) (*model.Workflow, error)
- func (s *NatsService) GetWorkflowInstance(ctx context.Context, workflowInstanceID string) (*model.WorkflowInstance, error)
- func (s *NatsService) GetWorkflowVersions(ctx context.Context, workflowName string) (*model.WorkflowVersions, error)
- func (s *NatsService) HasValidProcess(ctx context.Context, processInstanceId, workflowInstanceId string) (*model.ProcessInstance, *model.WorkflowInstance, error)
- func (s *NatsService) ListWorkflowInstance(ctx context.Context, workflowName string) (chan *model.ListWorkflowInstanceResult, chan error)
- func (s *NatsService) ListWorkflowInstanceProcesses(ctx context.Context, id string) ([]string, error)
- func (s *NatsService) ListWorkflows(ctx context.Context) (chan *model.ListWorkflowResult, chan error)
- func (s *NatsService) OwnerID(name string) (string, error)
- func (s *NatsService) OwnerName(id string) (string, error)
- func (s *NatsService) PublishMessage(ctx context.Context, workflowInstanceID string, name string, key string, ...) error
- func (s *NatsService) PublishWorkflowState(ctx context.Context, stateName string, state *model.WorkflowState, ...) error
- func (s *NatsService) SatisfyProcess(ctx context.Context, workflowInstance *model.WorkflowInstance, ...) error
- func (s *NatsService) SaveState(ctx context.Context, id string, state *model.WorkflowState) error
- func (s *NatsService) SetAbort(processor AbortFunc)
- func (s *NatsService) SetCompleteActivity(processor CompleteActivityFunc)
- func (s *NatsService) SetCompleteActivityProcessor(processor CompleteActivityProcessorFunc)
- func (s *NatsService) SetCompleteJobProcessor(processor CompleteJobProcessorFunc)
- func (s *NatsService) SetEventProcessor(processor EventProcessorFunc)
- func (s *NatsService) SetLaunchFunc(processor LaunchFunc)
- func (s *NatsService) SetMessageCompleteProcessor(processor MessageCompleteProcessorFunc)
- func (s *NatsService) SetMessageProcessor(processor MessageProcessorFunc)
- func (s *NatsService) SetTraversalProvider(provider TraversalFunc)
- func (s *NatsService) Shutdown()
- func (s *NatsService) StartProcessing(ctx context.Context) error
- func (s *NatsService) StoreWorkflow(ctx context.Context, wf *model.Workflow) (string, error)
- func (s *NatsService) WorkflowStats() *model.WorkflowStats
- func (s *NatsService) XDestroyWorkflowInstance(ctx context.Context, state *model.WorkflowState, ...) error
- type ProcessCompleteProcessorFunc
- type PublishOpt
- type TraversalFunc
Constants ¶
const ( AbortTypeActivity = iota // AbortTypeActivity signifies an activity is being aborted AbortTypeServiceTask = iota // AbortTypeServiceTask signifies a service task is being aborted )
Variables ¶
This section is empty.
Functions ¶
func WithEmbargo ¶ added in v1.0.215
func WithEmbargo(embargo int) *publishEmbargoOption
WithEmbargo allows the specification of an embargo time on a workflow state message
Types ¶
type AbortFunc ¶ added in v1.0.251
AbortFunc is the callback function type called when a workflow object aborts.
type AbortType ¶ added in v1.0.251
type AbortType int
AbortType represents the type of termination being handled by the abort function
type CompleteActivityFunc ¶ added in v1.0.235
type CompleteActivityFunc func(ctx context.Context, state *model.WorkflowState) error
CompleteActivityFunc is the callback function type which generates complete activity events.
type CompleteActivityProcessorFunc ¶ added in v1.0.215
type CompleteActivityProcessorFunc func(ctx context.Context, activity *model.WorkflowState) error
CompleteActivityProcessorFunc is the callback function type fired when an activity completes.
type CompleteJobProcessorFunc ¶
type CompleteJobProcessorFunc func(ctx context.Context, job *model.WorkflowState) error
CompleteJobProcessorFunc is the callback function type for completed tasks.
type EventProcessorFunc ¶
type EventProcessorFunc func(ctx context.Context, newActivityID string, traversal *model.WorkflowState, traverseOnly bool) error
EventProcessorFunc is the callback function type for processing workflow activities.
type LaunchFunc ¶ added in v1.0.215
type LaunchFunc func(ctx context.Context, state *model.WorkflowState) error
LaunchFunc is the callback function type used to start child workflows.
type MessageCompleteProcessorFunc ¶
type MessageCompleteProcessorFunc func(ctx context.Context, state *model.WorkflowState) error
MessageCompleteProcessorFunc is the callback function type for completed messages.
type MessageProcessorFunc ¶ added in v1.0.224
type MessageProcessorFunc func(ctx context.Context, state *model.WorkflowState, workflowInstance *model.WorkflowInstance, due int64) (bool, int, error)
MessageProcessorFunc is the callback function type used to create new workflow instances based on a timer.
type NatsService ¶
type NatsService struct {
// contains filtered or unexported fields
}
NatsService contains the engine functions that communicate with NATS.
func NewNatsService ¶
func NewNatsService(conn common.NatsConn, txConn common.NatsConn, storageType nats.StorageType, concurrency int, allowOrphanServiceTasks bool) (*NatsService, error)
NewNatsService creates a new instance of the NATS communication layer.
func (*NatsService) AwaitMsg ¶
func (s *NatsService) AwaitMsg(ctx context.Context, state *model.WorkflowState) error
AwaitMsg sets up a message subscription to wait for a workflow message
func (*NatsService) CloseUserTask ¶ added in v0.1.86
func (s *NatsService) CloseUserTask(ctx context.Context, trackingID string) error
CloseUserTask removes a completed user task.
func (*NatsService) Conn ¶
func (s *NatsService) Conn() common.NatsConn
Conn returns the active nats connection
func (*NatsService) CreateJob ¶
func (s *NatsService) CreateJob(ctx context.Context, job *model.WorkflowState) (string, error)
CreateJob stores a workflow task state.
func (*NatsService) CreateProcessInstance ¶ added in v1.0.427
func (s *NatsService) CreateProcessInstance(ctx context.Context, workflowInstanceID string, parentProcessID string, parentElementID string, processName string) (*model.ProcessInstance, error)
CreateProcessInstance creates a new instance of a process and attaches it to the workflow instance.
func (*NatsService) CreateWorkflowInstance ¶
func (s *NatsService) CreateWorkflowInstance(ctx context.Context, wfInstance *model.WorkflowInstance) (*model.WorkflowInstance, error)
CreateWorkflowInstance given a workflow, starts a new workflow instance and returns its ID
func (*NatsService) DeleteJob ¶ added in v1.0.215
func (s *NatsService) DeleteJob(_ context.Context, trackingID string) error
DeleteJob removes a workflow task state.
func (*NatsService) DestroyProcessInstance ¶ added in v1.0.427
func (s *NatsService) DestroyProcessInstance(ctx context.Context, state *model.WorkflowState, pi *model.ProcessInstance, wi *model.WorkflowInstance) error
DestroyProcessInstance deletes a process instance and removes the workflow instance dependent on all process instances being satisfied.
func (*NatsService) GetElement ¶ added in v0.1.175
func (s *NatsService) GetElement(ctx context.Context, state *model.WorkflowState) (*model.Element, error)
GetElement gets the definition for the current element given a workflow state.
func (*NatsService) GetGatewayInstance ¶ added in v1.0.446
func (s *NatsService) GetGatewayInstance(ctx context.Context, gatewayInstanceID string) (*model.Gateway, error)
GetGatewayInstance - returns a gateway instance from the KV store.
func (*NatsService) GetGatewayInstanceID ¶ added in v1.0.446
func (s *NatsService) GetGatewayInstanceID(state *model.WorkflowState) (string, string, error)
GetGatewayInstanceID - returns a gateawy instance ID and a satisfying route to that gateway.
func (*NatsService) GetJob ¶
func (s *NatsService) GetJob(ctx context.Context, trackingID string) (*model.WorkflowState, error)
GetJob gets a workflow task state.
func (*NatsService) GetLatestVersion ¶
GetLatestVersion queries the workflow versions table for the latest entry
func (*NatsService) GetMessageSenderRoutingKey ¶ added in v0.1.167
func (s *NatsService) GetMessageSenderRoutingKey(ctx context.Context, workflowName string, messageName string) (string, error)
GetMessageSenderRoutingKey gets an ID used to listen for workflow message instances.
func (*NatsService) GetOldState ¶ added in v1.0.215
func (s *NatsService) GetOldState(ctx context.Context, id string) (*model.WorkflowState, error)
GetOldState gets a task state given its tracking ID.
func (*NatsService) GetProcessInstance ¶ added in v1.0.427
func (s *NatsService) GetProcessInstance(ctx context.Context, processInstanceID string) (*model.ProcessInstance, error)
GetProcessInstance returns a process instance for a given process ID
func (*NatsService) GetProcessInstanceStatus ¶ added in v1.0.427
func (s *NatsService) GetProcessInstanceStatus(ctx context.Context, id string) ([]*model.WorkflowState, error)
GetProcessInstanceStatus returns a list of workflow statuses for the specified process instance ID.
func (*NatsService) GetServiceTaskRoutingKey ¶ added in v0.1.167
func (s *NatsService) GetServiceTaskRoutingKey(ctx context.Context, taskName string) (string, error)
GetServiceTaskRoutingKey gets a unique ID for a service task that can be used to listen for its activation.
func (*NatsService) GetUserTaskIDs ¶ added in v0.1.86
GetUserTaskIDs gets a list of tasks given an owner.
func (*NatsService) GetWorkflow ¶
GetWorkflow - retrieves a workflow model given its ID
func (*NatsService) GetWorkflowInstance ¶
func (s *NatsService) GetWorkflowInstance(ctx context.Context, workflowInstanceID string) (*model.WorkflowInstance, error)
GetWorkflowInstance retrieves workflow instance given its ID.
func (*NatsService) GetWorkflowVersions ¶ added in v1.0.366
func (s *NatsService) GetWorkflowVersions(ctx context.Context, workflowName string) (*model.WorkflowVersions, error)
GetWorkflowVersions - returns a list of versions for a given workflow.
func (*NatsService) HasValidProcess ¶ added in v1.0.427
func (s *NatsService) HasValidProcess(ctx context.Context, processInstanceId, workflowInstanceId string) (*model.ProcessInstance, *model.WorkflowInstance, error)
HasValidProcess - checks for a valid process and instance for a workflow process and instance ids
func (*NatsService) ListWorkflowInstance ¶
func (s *NatsService) ListWorkflowInstance(ctx context.Context, workflowName string) (chan *model.ListWorkflowInstanceResult, chan error)
ListWorkflowInstance returns a list of running workflows and versions given a workflow ID
func (*NatsService) ListWorkflowInstanceProcesses ¶ added in v1.0.427
func (s *NatsService) ListWorkflowInstanceProcesses(ctx context.Context, id string) ([]string, error)
ListWorkflowInstanceProcesses gets the current processIDs for a workflow instance.
func (*NatsService) ListWorkflows ¶
func (s *NatsService) ListWorkflows(ctx context.Context) (chan *model.ListWorkflowResult, chan error)
ListWorkflows returns a list of all the workflows in SHAR.
func (*NatsService) OwnerID ¶ added in v1.0.272
func (s *NatsService) OwnerID(name string) (string, error)
OwnerID gets a unique identifier for a task owner.
func (*NatsService) OwnerName ¶ added in v0.1.86
func (s *NatsService) OwnerName(id string) (string, error)
OwnerName retrieves an owner name given an ID.
func (*NatsService) PublishMessage ¶
func (s *NatsService) PublishMessage(ctx context.Context, workflowInstanceID string, name string, key string, vars []byte) error
PublishMessage publishes a workflow message.
func (*NatsService) PublishWorkflowState ¶
func (s *NatsService) PublishWorkflowState(ctx context.Context, stateName string, state *model.WorkflowState, opts ...PublishOpt) error
PublishWorkflowState publishes a SHAR state object to a given subject
func (*NatsService) SatisfyProcess ¶ added in v1.0.427
func (s *NatsService) SatisfyProcess(ctx context.Context, workflowInstance *model.WorkflowInstance, processName string) error
SatisfyProcess sets a process as "satisfied" i.e. it may no longer trigger.
func (*NatsService) SaveState ¶ added in v1.0.251
func (s *NatsService) SaveState(ctx context.Context, id string, state *model.WorkflowState) error
SaveState saves the task state.
func (*NatsService) SetAbort ¶ added in v1.0.251
func (s *NatsService) SetAbort(processor AbortFunc)
SetAbort sets the function called when a workflow object aborts.
func (*NatsService) SetCompleteActivity ¶ added in v1.0.235
func (s *NatsService) SetCompleteActivity(processor CompleteActivityFunc)
SetCompleteActivity sets the callback which generates complete activity events.
func (*NatsService) SetCompleteActivityProcessor ¶ added in v1.0.215
func (s *NatsService) SetCompleteActivityProcessor(processor CompleteActivityProcessorFunc)
SetCompleteActivityProcessor sets the callback fired when an activity completes.
func (*NatsService) SetCompleteJobProcessor ¶
func (s *NatsService) SetCompleteJobProcessor(processor CompleteJobProcessorFunc)
SetCompleteJobProcessor sets the callback for completed tasks.
func (*NatsService) SetEventProcessor ¶
func (s *NatsService) SetEventProcessor(processor EventProcessorFunc)
SetEventProcessor sets the callback for processing workflow activities.
func (*NatsService) SetLaunchFunc ¶ added in v1.0.215
func (s *NatsService) SetLaunchFunc(processor LaunchFunc)
SetLaunchFunc sets the callback used to start child workflows.
func (*NatsService) SetMessageCompleteProcessor ¶
func (s *NatsService) SetMessageCompleteProcessor(processor MessageCompleteProcessorFunc)
SetMessageCompleteProcessor sets the callback for completed messages.
func (*NatsService) SetMessageProcessor ¶ added in v1.0.224
func (s *NatsService) SetMessageProcessor(processor MessageProcessorFunc)
SetMessageProcessor sets the callback used to create new workflow instances based on a timer.
func (*NatsService) SetTraversalProvider ¶ added in v0.1.181
func (s *NatsService) SetTraversalProvider(provider TraversalFunc)
SetTraversalProvider sets the callback used to handle traversals.
func (*NatsService) Shutdown ¶
func (s *NatsService) Shutdown()
Shutdown signals the engine to stop processing.
func (*NatsService) StartProcessing ¶
func (s *NatsService) StartProcessing(ctx context.Context) error
StartProcessing begins listening to all the message processing queues.
func (*NatsService) StoreWorkflow ¶
StoreWorkflow stores a workflow definition and returns a unique ID
func (*NatsService) WorkflowStats ¶ added in v0.1.134
func (s *NatsService) WorkflowStats() *model.WorkflowStats
WorkflowStats obtains the running counts for the engine
func (*NatsService) XDestroyWorkflowInstance ¶ added in v1.0.427
func (s *NatsService) XDestroyWorkflowInstance(ctx context.Context, state *model.WorkflowState, cancellationState model.CancellationState, wfError *model.Error) error
XDestroyWorkflowInstance terminates a running workflow instance with a cancellation reason and error
type ProcessCompleteProcessorFunc ¶ added in v1.0.427
type ProcessCompleteProcessorFunc func(ctx context.Context, activity *model.WorkflowState) error
ProcessCompleteProcessorFunc is the callback for closing workflow processes.
type PublishOpt ¶ added in v1.0.215
type PublishOpt interface {
Apply(n *publishOptions)
}
PublishOpt represents an option that can be used when publishing a workflow state
type TraversalFunc ¶ added in v0.1.181
type TraversalFunc func(ctx context.Context, pr *model.ProcessInstance, trackingId common.TrackingID, outbound *model.Targets, el map[string]*model.Element, state *model.WorkflowState) error
TraversalFunc is the callback function type used to handle traversals.