dispatcher

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

Dispatcher publishes work messages to Redis Streams and events/results via the RedisStore.

func New

func New(s *store.RedisStore, logger chainedlog.Logger) *Dispatcher

New creates a new dispatcher backed by Redis.

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(ctx context.Context, job *types.Job, attempt int) error

Dispatch publishes a work message for a job to the tier-appropriate Redis Stream.

func (*Dispatcher) DispatchToDLQ

func (d *Dispatcher) DispatchToDLQ(ctx context.Context, job *types.Job, lastErr string) error

DispatchToDLQ moves a failed job to the dead letter queue.

func (*Dispatcher) PublishEvent

func (d *Dispatcher) PublishEvent(event types.JobEvent)

PublishEvent publishes a monitoring event via Pub/Sub + event stream, and fires any registered lifecycle hooks.

func (*Dispatcher) PublishResult

func (d *Dispatcher) PublishResult(result types.WorkResult)

PublishResult stores a completion result and notifies waiting clients.

func (*Dispatcher) SetHandlerVersions added in v0.1.10

func (d *Dispatcher) SetHandlerVersions(versions map[types.TaskType]string)

SetHandlerVersions sets the handler version map used to tag dispatched work messages. This enables version-aware routing: workers with a mismatched version will skip and re-enqueue.

func (*Dispatcher) SetHooks added in v0.1.10

func (d *Dispatcher) SetHooks(h *types.Hooks)

SetHooks sets the lifecycle hooks that are fired on each event.

func (*Dispatcher) Store

func (d *Dispatcher) Store() *store.RedisStore

Store returns the underlying RedisStore.

Jump to

Keyboard shortcuts

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