temporal

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{
	StartToCloseTimeout: DefaultStartToCloseTimeout,
	RetryPolicy:         DefaultRetryPolicy,
}
View Source
var DefaultRetryPolicy = &RetryPolicy{MaximumAttempts: 1}
View Source
var DefaultStartToCloseTimeout = time.Minute * 30

Functions

func Migrator

func Migrator(configuration ScheduleConfigs) error

func RegisterActionsAsWorkflows

func RegisterActionsAsWorkflows(model workflow.Model) map[string]*Model

func ScheduleWorker

func ScheduleWorker(workflow string) (interface{}, error)

Types

type Activity

type Activity struct {
	Name string
	Func interface{}
}

type ActivityExecutor

type ActivityExecutor = func(activity any, input any) (any, error)

type Client

type Client struct {
	client.Client
}

func Connect

func Connect(hosts ...string) Client

func (Client) HasModel

func (c Client) HasModel(name string) error

func (Client) Schedule

func (c Client) Schedule(name, id string) (*Schedule, error)

func (Client) ScheduledConfigs

func (c Client) ScheduledConfigs() (ScheduleConfigs, error)

func (Client) Start

func (c Client) Start(name string) (stop func())

func (Client) Submit

func (c Client) Submit(name, input string) error

type CustomLogger

type CustomLogger struct {
	// contains filtered or unexported fields
}

CustomLogger adapts the Simiango logger to Temporal's logging interface.

func NewCustomLogger

func NewCustomLogger() *CustomLogger

NewCustomLogger creates a new instance of CustomLogger.

func (*CustomLogger) Debug

func (c *CustomLogger) Debug(msg string, keyvals ...interface{})

Debug logs a debug message.

func (*CustomLogger) Error

func (c *CustomLogger) Error(msg string, keyvals ...interface{})

Error logs an error message.

func (*CustomLogger) Info

func (c *CustomLogger) Info(msg string, keyvals ...interface{})

Info logs an info message.

func (*CustomLogger) Warn

func (c *CustomLogger) Warn(msg string, keyvals ...interface{})

Warn logs a warning message.

type Model

type Model struct {
	Name       string
	Input      func() interface{}
	Workflow   Workflow
	Activities []Activity
	Options    Options
	// contains filtered or unexported fields
}

Model represents a Temporal Workflow.

func Register

func Register(name string, activities ...Activity) *Model

func RegisterWorkflowAsWorkflow

func RegisterWorkflowAsWorkflow(model workflow.Model) *Model

func (Model) Listen

func (m Model) Listen() (stop func())

Listen starts a Worker that listens on the Task Queue.

func (*Model) Schedule

func (m *Model) Schedule(id string) *Schedule

func (*Model) SetInput

func (m *Model) SetInput(i func() interface{}) *Model

SetInput sets the input object for the Model.

The input object is used to unmarshal the input string when submitting a Workflow.

func (*Model) SetOptions

func (m *Model) SetOptions(o Options) *Model

SetOptions sets the ActivityOptions for the Model.

func (*Model) SetWorkflowFunc

func (m *Model) SetWorkflowFunc(w Workflow) *Model

SetWorkflowFunc sets the Workflow function for the Model. When left unset, the Model will run a linear Workflow.

The Workflow function is used to create a custom Workflow. it accepts a single argument, a function that executes an Activity and returns the output.

func (*Model) Submit

func (m *Model) Submit(inputStr string) error

Submit starts a Workflow with the given input.

func (*Model) WorkflowID

func (m *Model) WorkflowID() string

type Options

type Options = workflow.ActivityOptions

type RetryPolicy

type RetryPolicy = sdk.RetryPolicy

type Schedule

type Schedule struct {
	// contains filtered or unexported fields
}

func (*Schedule) ID

func (s *Schedule) ID() string

func (*Schedule) Remove

func (s *Schedule) Remove() error

func (*Schedule) SetCron

func (s *Schedule) SetCron(cron string) *Schedule

func (*Schedule) SetInput

func (s *Schedule) SetInput(input string) *Schedule

func (*Schedule) Upsert

func (s *Schedule) Upsert() error

func (*Schedule) Validate

func (s *Schedule) Validate() error

type ScheduleConfig

type ScheduleConfig struct {
	Comment  string
	Workflow string
	ID       string
	Cron     string
	Input    string
}

ScheduleConfig represents a configuration for a scheduled workflow

func (ScheduleConfig) Event

func (s ScheduleConfig) Event() string

func (ScheduleConfig) Name

func (s ScheduleConfig) Name() string

func (*ScheduleConfig) ParseMemo

func (s *ScheduleConfig) ParseMemo(memo *common.Memo) error

type ScheduleConfigs

type ScheduleConfigs []ScheduleConfig

ScheduleConfigs is a collection of ScheduleConfig

func (*ScheduleConfigs) Add

func (configs *ScheduleConfigs) Add(config ScheduleConfig)

func (ScheduleConfigs) Contains

func (configs ScheduleConfigs) Contains(config ScheduleConfig) bool

func (ScheduleConfigs) Diff

func (configs ScheduleConfigs) Diff(comparable ScheduleConfigs) ScheduleConfigs

type Workflow

type Workflow = func(input ActivityExecutor) (any, error)

Jump to

Keyboard shortcuts

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