Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Ctx context.Context Logger *zap.Logger WorkersCount int Buffer int MetrixPrefix string }
Config holds all necessary config for worker
type ErrorHandler ¶ added in v0.3.0
type ErrorHandler func(msg *message.SSVMessage, err error) error
ErrorHandler func that handles an error for a specific message
type MsgHandler ¶ added in v0.3.0
type MsgHandler func(msg *message.SSVMessage) error
MsgHandler func that receive message.SSVMessage to handle
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker listen to queue and process the messages
func (*Worker) TryEnqueue ¶
func (w *Worker) TryEnqueue(msg *message.SSVMessage) bool
TryEnqueue tries to enqueue a job to the given job channel. Returns true if the operation was successful, and false if enqueuing would not have been possible without blocking. Job is not enqueued in the latter case.
func (*Worker) UseErrorHandler ¶ added in v0.3.0
func (w *Worker) UseErrorHandler(errHandler ErrorHandler)
UseErrorHandler registers an error handler
func (*Worker) UseHandler ¶ added in v0.3.0
func (w *Worker) UseHandler(handler MsgHandler)
UseHandler registers a message handler
Click to show internal directories.
Click to hide internal directories.