Documentation ¶
Index ¶
- Variables
- func IsWorkflowContextAsGoContext(ctx context.Context) bool
- func LongRunning[T any](wctx workflow.Context, interval time.Duration, total time.Duration, ...) (T, error)
- func New(cfg *Config, l *zap.Logger) (Client, LazyTemporalClient, error)
- func NewDataConverter(l *zap.Logger, cfg *DataConverterConfig, parent converter.DataConverter) (converter.DataConverter, error)
- func NewFromClient(cfg *MonitorConfig, l *zap.Logger, tclient client.Client) (Client, LazyTemporalClient, error)
- func NewWorker(l *zap.Logger, client client.Client, qname string, cfg WorkerConfig) worker.Worker
- func NewWorkflowContextAsGOContext(ctx workflow.Context) context.Context
- func WithActivityOptions(wctx workflow.Context, qname string, ac ActivityConfig) workflow.Context
- func WithoutDeadlockDetection(wctx workflow.Context, f func())
- type ActivityConfig
- type Client
- type Config
- type DataConverterConfig
- type DataConverterEncryptionConfig
- type LazyTemporalClient
- type MonitorConfig
- type WorkerConfig
- type WorkflowConfig
- type WorkflowContextAsGoContext
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoKeys = errors.New("at least one encryption key name must be provided") ErrKeyNotFound = errors.New("encryption key not found in environment") )
var ( Configs = configset.Set[Config]{ Default: &Config{ Monitor: defaultMonitorConfig, DataConverter: DataConverterConfig{ Compress: true, Encryption: DataConverterEncryptionConfig{ Encrypt: true, }, }, }, Dev: &Config{ Monitor: defaultMonitorConfig, StartDevServerIfNotUp: true, DevServer: testsuite.DevServerOptions{ LogLevel: zapcore.WarnLevel.String(), EnableUI: true, DBFilename: filepath.Join(xdg.DataHomeDir(), "temporal_dev.sqlite"), }, EnableHelperRedirect: true, }, Test: &Config{ Monitor: defaultMonitorConfig, AlwaysStartDevServer: true, DevServer: testsuite.DevServerOptions{ LogLevel: zapcore.WarnLevel.String(), EnableUI: true, }, }, } )
Functions ¶
func IsWorkflowContextAsGoContext ¶ added in v0.9.2
func LongRunning ¶ added in v0.9.2
func LongRunning[T any]( wctx workflow.Context, interval time.Duration, total time.Duration, f func(ctx context.Context) (T, error), ) (T, error)
LongRunning allows to execute the `f`, which does not perform any temporal operations (ie calling temporal using `wctx`) and thus might trigger the temporal deadlock detector. This function runs `f` in a separate go routine while periodically yielding to temporal in the calling goroutine each `interval`. If `interval` is less than `minInterval`, it is set to `minInterval`.
This function is useful for `f`s that we know are slow and should not have their result cached by temporal - they need to run every workflow invocation, including during replays. Example usage is resource allocation.
func NewDataConverter ¶ added in v0.10.0
func NewDataConverter(l *zap.Logger, cfg *DataConverterConfig, parent converter.DataConverter) (converter.DataConverter, error)
func NewFromClient ¶ added in v0.3.1
func NewFromClient(cfg *MonitorConfig, l *zap.Logger, tclient client.Client) (Client, LazyTemporalClient, error)
func NewWorker ¶ added in v0.9.2
NewWorker creates a new Temporal worker. If the worker is disabled, returns nil.
func NewWorkflowContextAsGOContext ¶
Creates a new GO context that gets the Done() signal from the workflow context. Performing long running operations in the returned context will block the workflow execution, which will result in Temporal's deadlock detector kicking in and kickking your butt.
func WithActivityOptions ¶ added in v0.9.2
func WithoutDeadlockDetection ¶ added in v0.9.4
WithoutDeadlockDetection allows to execute the `f`, which does not perform any temporal operations (ie calling temporal using `wctx`) and thus might trigger the temporal deadlock detector.
This function is useful for `f`s that we know are slow and should not have their result cached by temporal - they need to run every workflow invocation, including during replays. Example usage is resource allocation.
See also https://github.com/temporalio/temporal/issues/6546. Blame Maxim, not me.
Types ¶
type ActivityConfig ¶ added in v0.9.2
type ActivityConfig struct { ScheduleToCloseTimeout time.Duration `koanf:"schedule_to_close_timeout"` StartToCloseTimeout time.Duration `koanf:"start_to_close_timeout"` HeartbeatTimeout time.Duration `koanf:"heartbeat_timeout"` ScheduleToStartTimeout time.Duration `koanf:"schedule_to_start_timeout"` }
Common way to define configuration that can be used in multiple modules, saving the need to repeat the same configuration in each module.
func (ActivityConfig) ToOptions ¶ added in v0.9.2
func (ac ActivityConfig) ToOptions(qname string) workflow.ActivityOptions
func (ActivityConfig) With ¶ added in v0.9.2
func (ac ActivityConfig) With(other ActivityConfig) ActivityConfig
other overrides self.
type Config ¶
type Config struct { Monitor MonitorConfig `koanf:"monitor"` AlwaysStartDevServer bool `koanf:"always_start_dev_server"` StartDevServerIfNotUp bool `koanf:"start_dev_server_if_not_up"` HostPort string `koanf:"hostport"` Namespace string `koanf:"namespace"` // DevServer.ClientOptions is not used. DevServer testsuite.DevServerOptions `koanf:"dev_server"` TLS tlsConfig `koanf:"tls"` DataConverter DataConverterConfig `koanf:"data_converter"` EnableHelperRedirect bool `koanf:"enable_helper_redirect"` }
type DataConverterConfig ¶ added in v0.10.0
type DataConverterConfig struct { Compress bool `koanf:"compress"` Encryption DataConverterEncryptionConfig `koanf:"encryption"` }
type DataConverterEncryptionConfig ¶ added in v0.10.0
type DataConverterEncryptionConfig struct { // If `Encrypt` is true, `KeyNames` must have at least one key name specified. Encrypt bool `koanf:"encrypt"` // Comma-separated list of key names and values. // First key is used for encryption, others are used only for decryption. // Format: "key1=<64 char hex>,keys=<64 char hex>" // Example: "key1=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef,key2=abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" Keys string `koanf:"keys"` }
type LazyTemporalClient ¶ added in v0.9.2
type MonitorConfig ¶ added in v0.3.1
type WorkerConfig ¶ added in v0.9.2
type WorkerConfig struct { Disable bool `koanf:"disable"` WorkflowDeadlockTimeout time.Duration `koanf:"workflow_deadlock_timeout"` MaxConcurrentWorkflowTaskExecutionSize int `koanf:"max_concurrent_workflow_task_execution_size"` MaxConcurrentActivityExecutionSize int `koanf:"max_concurrent_activity_execution_size"` }
Common way to define configuration that can be used in multiple modules, saving the need to repeat the same configuration in each module.
func (WorkerConfig) With ¶ added in v0.9.2
func (wc WorkerConfig) With(other WorkerConfig) WorkerConfig
other overrides self.
type WorkflowConfig ¶ added in v0.9.2
Common way to define configuration that can be used in multiple modules, saving the need to repeat the same configuration in each module.
func (WorkflowConfig) ToStartWorkflowOptions ¶ added in v0.9.2
func (wc WorkflowConfig) ToStartWorkflowOptions(qname, id, sum string, memo map[string]string) client.StartWorkflowOptions
func (WorkflowConfig) With ¶ added in v0.9.2
func (wc WorkflowConfig) With(other WorkflowConfig) WorkflowConfig
other overrides self.
type WorkflowContextAsGoContext ¶
type WorkflowContextAsGoContext struct { workflow.Context // contains filtered or unexported fields }
func (*WorkflowContextAsGoContext) Deadline ¶
func (wctx *WorkflowContextAsGoContext) Deadline() (time.Time, bool)
func (*WorkflowContextAsGoContext) Done ¶
func (wctx *WorkflowContextAsGoContext) Done() <-chan struct{}
func (*WorkflowContextAsGoContext) Err ¶
func (wctx *WorkflowContextAsGoContext) Err() error
func (*WorkflowContextAsGoContext) Value ¶
func (wctx *WorkflowContextAsGoContext) Value(key any) any