Documentation ¶
Index ¶
- Constants
- func ReParentSpan(ctx context.Context, state *model.WorkflowState) context.Context
- type Client
- func (c *Client) CancelProcessInstance(ctx context.Context, executionID string) error
- func (c *Client) CompleteUserTask(ctx context.Context, owner string, trackingID string, newVars model.Vars) error
- func (c *Client) DeprecateTaskSpec(ctx context.Context, name string) error
- func (c *Client) Dial(ctx context.Context, natsURL string, opts ...nats.Option) error
- func (c *Client) GetJob(ctx context.Context, id string) (*model.WorkflowState, error)
- func (c *Client) GetProcessHistory(ctx context.Context, processInstanceId string) ([]*model.ProcessHistoryEntry, error)
- func (c *Client) GetProcessInstanceStatus(ctx context.Context, id string) ([]*model.WorkflowState, error)
- func (c *Client) GetServerVersion(ctx context.Context) (*version.Version, error)
- func (c *Client) GetTaskSpecByUID(ctx context.Context, uid string) (*model.TaskSpec, error)
- func (c *Client) GetTaskSpecUsage(ctx context.Context, id string) (*model.TaskSpecUsageReport, error)
- func (c *Client) GetTaskSpecVersions(ctx context.Context, name string) ([]string, error)
- func (c *Client) GetTaskUIDFromSpec(spec *model.TaskSpec) (string, error)
- func (c *Client) GetUserTask(ctx context.Context, owner string, trackingID string) (*model.GetUserTaskResponse, model.Vars, error)
- func (c *Client) GetWorkflow(ctx context.Context, id string) (*model.Workflow, error)
- func (c *Client) GetWorkflowVersions(ctx context.Context, name string) ([]*model.WorkflowVersion, error)
- func (c *Client) HasWorkflowDefinitionChanged(ctx context.Context, name string, b []byte) (bool, error)
- func (c *Client) LaunchProcess(ctx context.Context, processId string, mvars model.Vars) (executionId string, workflowId string, er error)
- func (c *Client) ListExecutableProcesses(ctx context.Context) ([]*model.ListExecutableProcessesItem, error)
- func (c *Client) ListExecution(ctx context.Context, name string) ([]*model.ListExecutionItem, error)
- func (c *Client) ListExecutionProcesses(ctx context.Context, id string) (*model.ListExecutionProcessesResponse, error)
- func (c *Client) ListTaskSpecs(ctx context.Context, includeDeprecated bool) ([]*model.TaskSpec, error)
- func (c *Client) ListUserTaskIDs(ctx context.Context, owner string) (*model.UserTasks, error)
- func (c *Client) ListWorkflows(ctx context.Context) ([]*model.ListWorkflowResponse, error)
- func (c *Client) Listen(ctx context.Context) error
- func (c *Client) LoadBPMNWorkflowFromBytes(ctx context.Context, name string, b []byte) (string, error)
- func (c *Client) RegisterMessageSender(ctx context.Context, workflowName string, messageName string, sender SenderFn) error
- func (c *Client) RegisterProcessComplete(processId string, fn ProcessTerminateFn) error
- func (c *Client) RegisterTaskFunction(ctx context.Context, spec *model.TaskSpec, fn ServiceFn) error
- func (c *Client) ResolveWorkflow(ctx context.Context, workflow *model.Workflow) (*model.Workflow, error)
- func (c *Client) SendMessage(ctx context.Context, name string, key any, mvars model.Vars) error
- func (c *Client) Shutdown()
- func (c *Client) StoreTask(ctx context.Context, spec *model.TaskSpec) error
- type ConfigurationOption
- type ErrTaskInUse
- type FixedIDOption
- type JobClient
- type LogClient
- type MessageClient
- type OpenTelemetry
- type ProcessTerminateFn
- type RegOpt
- type SenderFn
- type ServiceFn
- type TaskSpecOption
Constants ¶
const HeartBeatInterval = 1 * time.Second
HeartBeatInterval defines the time between client heartbeats.
Variables ¶
This section is empty.
Functions ¶
func ReParentSpan ¶ added in v1.1.848
ReParentSpan re-parents a span in the given context with the span ID obtained from the WorkflowState ID. If the span context in the context is valid, it replaces the span ID with the 64-bit representation obtained from the WorkflowState ID. Otherwise, it returns the original context.
Parameters: - ctx: The context to re-parent the span in. - state: The WorkflowState containing the ID to extract the new span ID from.
Returns: - The context with the re-parented span ID or the original context if the span context is invalid.
Types ¶
type Client ¶
type Client struct { SvcTasks map[string]ServiceFn MsgSender map[string]SenderFn ExpectedCompatibleServerVersion *version.Version ExpectedServerVersion *version.Version SendMiddleware []middleware2.Send ReceiveMiddleware []middleware2.Receive // contains filtered or unexported fields }
Client implements a SHAR client capable of listening for service task activations, listening for Workflow Messages, and integrating with the API
func (*Client) CancelProcessInstance ¶ added in v1.0.645
CancelProcessInstance cancels a running Process Instance.
func (*Client) CompleteUserTask ¶
func (c *Client) CompleteUserTask(ctx context.Context, owner string, trackingID string, newVars model.Vars) error
CompleteUserTask completes a task and sends the variables back to the workflow
func (*Client) DeprecateTaskSpec ¶ added in v1.1.670
DeprecateTaskSpec deprecates a task spec by name.
func (*Client) GetProcessHistory ¶ added in v1.0.477
func (c *Client) GetProcessHistory(ctx context.Context, processInstanceId string) ([]*model.ProcessHistoryEntry, error)
GetProcessHistory gets the history for a process.
func (*Client) GetProcessInstanceStatus ¶ added in v1.0.427
func (c *Client) GetProcessInstanceStatus(ctx context.Context, id string) ([]*model.WorkflowState, error)
GetProcessInstanceStatus lists the current workflow states for a process instance.
func (*Client) GetServerVersion ¶ added in v1.0.514
GetServerVersion returns the current server version
func (*Client) GetTaskSpecByUID ¶ added in v1.0.623
GetTaskSpecByUID gets a versioned task spec by its UID
func (*Client) GetTaskSpecUsage ¶ added in v1.1.670
func (c *Client) GetTaskSpecUsage(ctx context.Context, id string) (*model.TaskSpecUsageReport, error)
GetTaskSpecUsage returns a report outlining task spec usage in executable and executing workflows.
func (*Client) GetTaskSpecVersions ¶ added in v1.1.670
GetTaskSpecVersions returns the version IDs associated with the named task spec.
func (*Client) GetTaskUIDFromSpec ¶ added in v1.1.1026
GetTaskUIDFromSpec returns a UID (string) based on a deterministic algorithm from a TaskSpec.
func (*Client) GetUserTask ¶ added in v0.1.88
func (c *Client) GetUserTask(ctx context.Context, owner string, trackingID string) (*model.GetUserTaskResponse, model.Vars, error)
GetUserTask fetches details for a user task based upon an ID obtained from, ListUserTasks
func (*Client) GetWorkflow ¶ added in v1.0.366
GetWorkflow - retrieves a workflow model given its ID
func (*Client) GetWorkflowVersions ¶ added in v1.0.366
func (c *Client) GetWorkflowVersions(ctx context.Context, name string) ([]*model.WorkflowVersion, error)
GetWorkflowVersions - returns a list of versions for a given workflow.
func (*Client) HasWorkflowDefinitionChanged ¶ added in v1.0.366
func (c *Client) HasWorkflowDefinitionChanged(ctx context.Context, name string, b []byte) (bool, error)
HasWorkflowDefinitionChanged - given a workflow name and a BPMN xml, return true if the resulting definition is different.
func (*Client) LaunchProcess ¶ added in v1.0.645
func (c *Client) LaunchProcess(ctx context.Context, processId string, mvars model.Vars) (executionId string, workflowId string, er error)
LaunchProcess launches a new process within a workflow/BPMN definition. It returns the execution Id of the launched process and the workflow id of the BPMN definition containing the process
func (*Client) ListExecutableProcesses ¶ added in v1.1.1032
func (c *Client) ListExecutableProcesses(ctx context.Context) ([]*model.ListExecutableProcessesItem, error)
ListExecutableProcesses gets a list of executable processes.
func (*Client) ListExecution ¶ added in v1.0.645
func (c *Client) ListExecution(ctx context.Context, name string) ([]*model.ListExecutionItem, error)
ListExecution gets a list of running executions by workflow name.
func (*Client) ListExecutionProcesses ¶ added in v1.0.645
func (c *Client) ListExecutionProcesses(ctx context.Context, id string) (*model.ListExecutionProcessesResponse, error)
ListExecutionProcesses lists the current process IDs for an Execution.
func (*Client) ListTaskSpecs ¶ added in v1.1.725
func (c *Client) ListTaskSpecs(ctx context.Context, includeDeprecated bool) ([]*model.TaskSpec, error)
ListTaskSpecs lists active and optionally deprecated task specs.
func (*Client) ListUserTaskIDs ¶ added in v0.1.86
ListUserTaskIDs returns a list of user tasks for a particular owner
func (*Client) ListWorkflows ¶
ListWorkflows gets a list of launchable workflow in SHAR.
func (*Client) LoadBPMNWorkflowFromBytes ¶
func (c *Client) LoadBPMNWorkflowFromBytes(ctx context.Context, name string, b []byte) (string, error)
LoadBPMNWorkflowFromBytes loads, parses, and stores a BPMN workflow in SHAR. Returns the uuid uniquely identifying the workflow.
func (*Client) RegisterMessageSender ¶
func (c *Client) RegisterMessageSender(ctx context.Context, workflowName string, messageName string, sender SenderFn) error
RegisterMessageSender registers a function that requires support for sending Workflow Messages
func (*Client) RegisterProcessComplete ¶ added in v1.0.477
func (c *Client) RegisterProcessComplete(processId string, fn ProcessTerminateFn) error
RegisterProcessComplete registers a function to be executed when a shar workflow process terminates.
func (*Client) RegisterTaskFunction ¶ added in v1.1.947
func (c *Client) RegisterTaskFunction(ctx context.Context, spec *model.TaskSpec, fn ServiceFn) error
RegisterTaskFunction registers a service task function. If the service task spec has no UID then it will be calculated and written to the Metadata.Uid field.
func (*Client) ResolveWorkflow ¶ added in v1.1.927
func (c *Client) ResolveWorkflow(ctx context.Context, workflow *model.Workflow) (*model.Workflow, error)
ResolveWorkflow - returns a list of versions for a given workflow.
func (*Client) SendMessage ¶
SendMessage sends a Workflow Message to a specific workflow instance
type ConfigurationOption ¶ added in v1.1.848
type ConfigurationOption interface {
// contains filtered or unexported methods
}
ConfigurationOption represents an interface for configuring a client.
func WithConcurrency ¶ added in v1.0.320
func WithConcurrency(n int) ConfigurationOption
WithConcurrency specifies the number of threads to process each service task.
func WithEphemeralStorage ¶ added in v0.1.175
func WithEphemeralStorage() ConfigurationOption
WithEphemeralStorage specifies a client store the result of all operations in memory.
func WithNamespace ¶ added in v1.1.835
func WithNamespace(name string) ConfigurationOption
WithNamespace applies a client namespace.
func WithNoOSSig ¶ added in v1.1.731
func WithNoOSSig() ConfigurationOption
WithNoOSSig disables SIGINT and SIGKILL processing within the client.
func WithNoRecovery ¶ added in v1.1.677
func WithNoRecovery() ConfigurationOption
WithNoRecovery disables panic recovery for debugging.
type ErrTaskInUse ¶ added in v1.1.670
type ErrTaskInUse struct { Err error Usage *model.TaskSpecUsageReport }
ErrTaskInUse is returned when an operation failed because it was attempted on a task in use.
func (ErrTaskInUse) Error ¶ added in v1.1.670
func (e ErrTaskInUse) Error() string
Error returns the string version of the ErrWorkflowFatal error
type FixedIDOption ¶ added in v1.0.514
type FixedIDOption struct {
// contains filtered or unexported fields
}
FixedIDOption contains a fixed ID which will be used to register a task
func WithFixedID ¶ added in v1.0.514
func WithFixedID(id string) FixedIDOption
WithFixedID is a modifier which returns a FixedIDOption containing the specified ID.
type JobClient ¶ added in v1.0.271
type JobClient interface { LogClient }
JobClient represents a client that is sent to all service tasks to facilitate logging.
type LogClient ¶ added in v1.0.273
type LogClient interface { // Log logs to the underlying SHAR infrastructure. Log(ctx context.Context, level slog.Level, message string, attrs map[string]string) error }
LogClient represents a client which is capable of logging to the SHAR infrastructure.
type MessageClient ¶ added in v1.0.271
type MessageClient interface { LogClient // SendMessage sends a Workflow Message SendMessage(ctx context.Context, name string, key any, vars model.Vars) error }
MessageClient represents a client which supports logging and sending Workflow Messages to the underlying SHAR infrastructure.
type OpenTelemetry ¶ added in v1.1.848
type OpenTelemetry struct { }
OpenTelemetry represents a type for enabling OpenTelemetry for a client.
func WithOpenTelemetry ¶ added in v1.1.848
func WithOpenTelemetry() OpenTelemetry
WithOpenTelemetry enables the flow of Open Telemetry Trace and Span IDs.
type ProcessTerminateFn ¶ added in v1.0.477
type ProcessTerminateFn func(ctx context.Context, vars model.Vars, wfError *model.Error, endState model.CancellationState)
ProcessTerminateFn provides the signature for process terminate functions.
type RegOpt ¶ added in v1.0.514
type RegOpt interface {
// contains filtered or unexported methods
}
RegOpt represents an option that can be passed to the task register function.
type SenderFn ¶ added in v1.0.267
SenderFn provides the signature for functions that can act as Workflow Message senders.
type TaskSpecOption ¶ added in v1.0.514
type TaskSpecOption struct {
// contains filtered or unexported fields
}
TaskSpecOption contains the task specification.
func WithSpec ¶ added in v1.0.514
func WithSpec(spec *model.TaskSpec) TaskSpecOption
WithSpec allows the client to define a task specification to SHAR.