Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configurator ¶
type Configurator interface { // Configure is an entrypoint. It is registered as a Temporal workflow. Configure(ctx workflow.Context, systemID string) error ConfiguratorName() string }
Configurator is an interface that wraps configuration methods. Configure will be registered as a Temporal workflow for service configuration.
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool contains a collection of Temporal Workers that can be configured at runtime by executing workflows on the main worker. WithConfigurator can be used to provide additional configuration workflows that will be attached to the main worker.
func NewWorkerPool ¶
func NewWorkerPool(systemID string, client client.Client, options ...WorkerPoolOption) *WorkerPool
NewWorkerPool returns WorkerPool that has a main worker polling Temporal Task Queue named after systemID@main Main worker will execute any configurator workflow provided
func (*WorkerPool) AddWorker ¶
func (p *WorkerPool) AddWorker(group, taskQueue string, workflows, activities map[string]interface{}, opts worker.Options) error
AddWorker adds new worker to the worker pool with registered workflows and activities. This method allows you to create several workers listening on the same task queue (because this is a valid case). However that might be not desired in certain scenarios. Named group can be used to track workers registered for specific use cases. If there is a need to remove workers, usage of a group might be handy, because RemoveWorkers method is doing removal of all workers inside the group.
func (*WorkerPool) Error ¶
func (p *WorkerPool) Error() error
func (*WorkerPool) RemoveWorkers ¶
func (p *WorkerPool) RemoveWorkers(group string)
RemoveWorkers stops all the workers of a certain group and removes them from the pool.
func (*WorkerPool) Start ¶
func (p *WorkerPool) Start() error
Start starts the main worker process that controls worker pool
type WorkerPoolOption ¶
type WorkerPoolOption func(*WorkerPool)
WorkerPoolOption allows to set additional WorkerPool options
func WithConfigurator ¶
func WithConfigurator(configurator Configurator) WorkerPoolOption
WithConfigurator adds Configurator that will be registered as a workflow
func WithMainWorkerTaskQueueSuffix ¶
func WithMainWorkerTaskQueueSuffix(s string) WorkerPoolOption
WithMainWorkerTaskQueueSuffix sets main worker Task Queue suffix Main TaskQueue has format: {systemID}@{suffix} (default: "main")
func WithWorkerConstructor ¶
func WithWorkerConstructor(fn workerConstructor) WorkerPoolOption
WithWorkerConstructor sets constructor function used to construct worker.Worker. Can be used to provide alternative constructor for tests (default: "worker.New")