Documentation
¶
Index ¶
- type Dispatcher
- func (d *Dispatcher) Dispatch(ctx context.Context, job *types.Job, attempt int) error
- func (d *Dispatcher) DispatchToDLQ(ctx context.Context, job *types.Job, lastErr string) error
- func (d *Dispatcher) PublishEvent(event types.JobEvent)
- func (d *Dispatcher) PublishResult(result types.WorkResult)
- func (d *Dispatcher) SetHandlerVersions(versions map[types.TaskType]string)
- func (d *Dispatcher) SetHooks(h *types.Hooks)
- func (d *Dispatcher) Store() *store.RedisStore
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 ¶
Dispatch publishes a work message for a job to the tier-appropriate Redis Stream.
func (*Dispatcher) DispatchToDLQ ¶
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.