client

package
v1.0.408 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithConcurrency added in v1.0.320

func WithConcurrency(n int) concurrency

WithConcurrency specifies the number of threads to process each service task.

func WithEphemeralStorage added in v0.1.175

func WithEphemeralStorage() ephemeralStorage

WithEphemeralStorage specifies a client store the result of all operations in memory.

Types

type Client

type Client struct {
	SvcTasks map[string]ServiceFn

	MsgSender map[string]SenderFn
	// contains filtered or unexported fields
}

Client implements a SHAR client capable of listening for service task activations, listening for Workflow Messages, and interating with the API

func New

func New(option ...Option) *Client

New creates a new SHAR client instance

func (*Client) CancelWorkflowInstance

func (c *Client) CancelWorkflowInstance(ctx context.Context, instanceID string) error

CancelWorkflowInstance cancels a running workflow 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) Dial

func (c *Client) Dial(natsURL string, opts ...nats.Option) error

Dial instructs the client to connect to a NATS server.

func (*Client) GetJob added in v1.0.279

func (c *Client) GetJob(ctx context.Context, id string) (*model.WorkflowState, error)

GetJob returns a Job given a tracking ID

func (*Client) GetServerInstanceStats added in v0.1.134

func (c *Client) GetServerInstanceStats(ctx context.Context) (*model.WorkflowStats, error)

GetServerInstanceStats is an unsupported function to obtain server metrics

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

func (c *Client) GetWorkflow(ctx context.Context, id string) (*model.Workflow, error)

GetWorkflow - retrieves a workflow model given its ID

func (*Client) GetWorkflowInstanceStatus

func (c *Client) GetWorkflowInstanceStatus(ctx context.Context, id string) ([]*model.WorkflowState, error)

GetWorkflowInstanceStatus get the current execution state for a workflow instance.

func (*Client) GetWorkflowVersions added in v1.0.366

func (c *Client) GetWorkflowVersions(ctx context.Context, name string) (*model.WorkflowVersions, 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) LaunchWorkflow

func (c *Client) LaunchWorkflow(ctx context.Context, workflowName string, mvars model.Vars) (string, string, error)

LaunchWorkflow launches a new workflow instance.

func (*Client) ListUserTaskIDs added in v0.1.86

func (c *Client) ListUserTaskIDs(ctx context.Context, owner string) (*model.UserTasks, error)

ListUserTaskIDs returns a list of user tasks for a particular owner

func (*Client) ListWorkflowInstance

func (c *Client) ListWorkflowInstance(ctx context.Context, name string) ([]*model.ListWorkflowInstanceResult, error)

ListWorkflowInstance gets a list of running workflow instances by workflow name.

func (*Client) ListWorkflows

func (c *Client) ListWorkflows(ctx context.Context) ([]*model.ListWorkflowResult, error)

ListWorkflows gets a list of launchable workflow in SHAR.

func (*Client) Listen

func (c *Client) Listen(ctx context.Context) error

Listen starts processing the client message queues.

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.

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) RegisterServiceTask

func (c *Client) RegisterServiceTask(ctx context.Context, taskName string, fn ServiceFn) error

RegisterServiceTask adds a new service task to listen for to the client.

func (*Client) RegisterWorkflowInstanceComplete added in v0.1.66

func (c *Client) RegisterWorkflowInstanceComplete(fn chan *model.WorkflowInstanceComplete)

RegisterWorkflowInstanceComplete registers a function to run when workflow instances complete.

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, workflowInstanceID string, name string, key any, mvars model.Vars) error

SendMessage sends a Workflow Message to a specific workflow instance

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, severity messages.WorkflowLogLevel, code int32, 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 instrastructure.

type Option added in v0.1.86

type Option interface {
	// contains filtered or unexported methods
}

Option represents a configuration changer for the client.

type SenderFn added in v1.0.267

type SenderFn func(ctx context.Context, client MessageClient, vars model.Vars) error

SenderFn provides the signature for functions that can act as Workflow Message senders.

type ServiceFn added in v1.0.267

type ServiceFn func(ctx context.Context, client JobClient, vars model.Vars) (model.Vars, error)

ServiceFn provides the signature for service task functions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL