Documentation
      ¶
    
    
  
    
  
    Index ¶
- func Provide() fx.Option
 - func ProvideClient[T generatedClient, O any](newClientFn func(client.Client, ...O) T, opts ...O) fx.Option
 - func ProvideRegistration[W, A any](queueName string, regFn func(worker worker.Worker, wf W, act A)) fx.Option
 - type Client
 - type Config
 - type DefaultClientInterceptor
 - type DefaultWorkerInterceptor
 - func (w *DefaultWorkerInterceptor) InterceptActivity(ctx context.Context, next interceptor.ActivityInboundInterceptor) interceptor.ActivityInboundInterceptor
 - func (w *DefaultWorkerInterceptor) InterceptWorkflow(ctx workflow.Context, next interceptor.WorkflowInboundInterceptor) interceptor.WorkflowInboundInterceptor
 
- type Registration
 - type Temporal
 - type Workers
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProvideClient ¶ added in v0.0.166
Types ¶
type Client ¶
type Client[T generatedClient] struct{ W T }
    Client wraps a generated Workflow client. The wrapping simply exists so we can set the underlying temporal client in a "onStart" hook.
type Config ¶
type Config struct {
	// temporal server grpc
	TemporalHostPort string `env:"TEMPORAL_HOST_PORT" envDefault:"localhost:7233"`
	// temporal namespace for this deployment
	TemporalNamespace string `env:"TEMPORAL_NAMESPACE" envDefault:"default"`
	// API key for authentication with the cluster.
	TemporalAPIKey string `env:"TEMPORAL_API_KEY"`
	// create and use randomly-named namespace, mainly for testing.
	CreateAndUseRandomNamespace bool `env:"CREATE_AND_USE_RANDOM_NAMESPACE"`
	// remove the namespace when the client shuts down, only taken into account with: CREATE_AND_USE_RANDOM_NAMESPACE
	AutoRemoveNamespace bool `env:"AUTO_REMOVE_NAMESPACE"`
	// in some cases the workers are not necessary to be run (such as when the code is also run as a Lambda)
	DisableWorkers bool `env:"DISABLE_WORKERS"`
}
    type DefaultClientInterceptor ¶ added in v0.0.185
type DefaultClientInterceptor struct {
	interceptor.ClientInterceptorBase
	// contains filtered or unexported fields
}
    DefaultClientInterceptor validates workflow & signal/update args on the caller side.
func NewDefaultClientInterceptor ¶ added in v0.0.185
func NewDefaultClientInterceptor(val protovalidate.Validator) *DefaultClientInterceptor
func (*DefaultClientInterceptor) InterceptClient ¶ added in v0.0.185
func (c *DefaultClientInterceptor) InterceptClient( next interceptor.ClientOutboundInterceptor, ) interceptor.ClientOutboundInterceptor
type DefaultWorkerInterceptor ¶ added in v0.0.185
type DefaultWorkerInterceptor struct {
	interceptor.InterceptorBase
	// contains filtered or unexported fields
}
    func NewDefaultWorkerInterceptor ¶ added in v0.0.185
func NewDefaultWorkerInterceptor( val protovalidate.Validator, logs *zap.Logger, ) *DefaultWorkerInterceptor
NewDefaultWorkerInterceptor initializes an interceptor for our worker. It implements cross-cutting concerns for all activity and workflow execution. Such as input validation.
func (*DefaultWorkerInterceptor) InterceptActivity ¶ added in v0.0.185
func (w *DefaultWorkerInterceptor) InterceptActivity( ctx context.Context, next interceptor.ActivityInboundInterceptor, ) interceptor.ActivityInboundInterceptor
InterceptActivity intercepts activities.
func (*DefaultWorkerInterceptor) InterceptWorkflow ¶ added in v0.0.185
func (w *DefaultWorkerInterceptor) InterceptWorkflow( ctx workflow.Context, next interceptor.WorkflowInboundInterceptor, ) interceptor.WorkflowInboundInterceptor
InterceptWorkflow intercepts workflows.
type Registration ¶
type Registration struct {
	// contains filtered or unexported fields
}
    Registration describes registering of workflow and activities with a worker.
type Temporal ¶
type Temporal struct {
	// contains filtered or unexported fields
}
    Temporal holds a reference to the Temporal Temporal.
func New ¶
func New(par struct {
	fx.In
	fx.Lifecycle
	Config Config
	Logger *zap.Logger
	// propagators and interceptrs, the order matter so we can't use value groups (directly).
	Propagators  []workflow.ContextPropagator    `optional:"true"`
	Interceptors []interceptor.ClientInterceptor `optional:"true"`
},
) (*Temporal, error)
    New inits the Temporal client.
type Workers ¶
type Workers struct {
	// contains filtered or unexported fields
}
    Workers represent the set of Temporal workers.
func NewWorkers ¶
func NewWorkers(par struct {
	fx.In
	fx.Lifecycle
	Logger   *zap.Logger
	Temporal *Temporal
	Interceptors  []interceptor.WorkerInterceptor `optional:"true"`
	Registrations []*Registration                 `group:"registrations"`
},
) (*Workers, error)
    NewWorkers inits a new set of workers.