worker

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package worker provides background worker functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxWorkers   int
	MaxQueueSize int
}

Config holds the configuration for the worker.

type ServiceRegistrationWorker

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

ServiceRegistrationWorker is a background worker responsible for handling service registration requests. It listens for ServiceRegistrationRequest messages on the event bus, processes them using the service registry, and publishes the results as ServiceRegistrationResult messages.

func NewServiceRegistrationWorker

func NewServiceRegistrationWorker(bus *bus.Provider, serviceRegistry serviceregistry.ServiceRegistryInterface) *ServiceRegistrationWorker

NewServiceRegistrationWorker creates a new ServiceRegistrationWorker.

bus is the event bus used for receiving requests and publishing results. serviceRegistry is the registry that will handle the actual registration logic.

func (*ServiceRegistrationWorker) Start

Start launches the worker in a new goroutine. It subscribes to service registration requests on the event bus and will continue to process them until the provided context is canceled.

ctx is the context that controls the lifecycle of the worker.

type UpstreamWorker

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

UpstreamWorker is a background worker that handles tool execution requests. It listens for ToolExecutionRequest messages on the event bus, uses the tool manager to execute the requested tool, and then publishes the outcome as a ToolExecutionResult message.

func NewUpstreamWorker

func NewUpstreamWorker(bus *bus.Provider, toolManager tool.ManagerInterface) *UpstreamWorker

NewUpstreamWorker creates a new UpstreamWorker.

bus is the event bus used for receiving requests and publishing results. toolManager is the tool manager that will handle the actual tool execution.

func (*UpstreamWorker) Start

func (w *UpstreamWorker) Start(ctx context.Context)

Start launches the worker in a new goroutine. It subscribes to tool execution requests on the event bus and will continue to process them until the provided context is canceled.

ctx is the context that controls the lifecycle of the worker.

type Worker

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

Worker is responsible for processing jobs from the bus.

func New

func New(busProvider *bus.Provider, cfg *Config) *Worker

New creates a new Worker.

func (*Worker) Start

func (w *Worker) Start(ctx context.Context)

Start starts the worker.

func (*Worker) Stop

func (w *Worker) Stop()

Stop stops the worker.

Jump to

Keyboard shortcuts

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