Documentation
¶
Index ¶
- func DecodeDeadLetter(encoded []byte, visibility management.PayloadVisibility) (management.JobRecord, error)
- type Option
- func WithAddr(addr string) Option
- func WithChannel(channel string) Option
- func WithConnectTimeout(timeout time.Duration) Option
- func WithDeadLetter(topic string, maxAttempts uint16) Option
- func WithLogLevel(lvl nsq.LogLevel) Option
- func WithLogger(l queue.Logger) Option
- func WithMaxInFlight(num int) Option
- func WithRequestTimeout(timeout time.Duration) Option
- func WithRunFunc(fn func(context.Context, core.TaskMessage) error) Option
- func WithTopic(topic string) Option
- func WithTouchInterval(interval time.Duration) Option
- type OptionFunc
- type Options
- type Worker
- func (*Worker) BackendName() string
- func (w *Worker) Queue(job core.TaskMessage) error
- func (w *Worker) QueueName() string
- func (w *Worker) Request() (core.TaskMessage, error)
- func (w *Worker) Run(ctx context.Context, task core.TaskMessage) error
- func (w *Worker) Shutdown() error
- func (w *Worker) Stats() *nsq.ConsumerStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeDeadLetter ¶
func DecodeDeadLetter( encoded []byte, visibility management.PayloadVisibility, ) (management.JobRecord, error)
DecodeDeadLetter converts one package-owned NSQ terminal envelope into the backend-neutral management record without exposing NSQ client types.
Types ¶
type Option ¶
type Option interface {
Apply(*Options)
}
An Option configures a mutex.
func WithConnectTimeout ¶
WithConnectTimeout bounds NSQ producer and consumer connection attempts.
func WithDeadLetter ¶
WithDeadLetter configures the package-owned terminal topic and bounded NSQ delivery-attempt policy.
func WithLogLevel ¶
WithLogLevel set custom nsq log level
func WithMaxInFlight ¶
WithMaxInFlight Maximum number of messages to allow in flight (concurrency knob)
func WithRequestTimeout ¶
WithRequestTimeout sets how long Request waits for an NSQ message.
func WithRunFunc ¶
WithRunFunc setup the run func of queue
func WithTouchInterval ¶
WithTouchInterval sets how often an in-flight NSQ message is touched.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker for NSQ
func NewWorkerE ¶
NewWorkerE creates a worker and returns configuration errors.
func (*Worker) BackendName ¶
BackendName identifies NSQ in lifecycle events.
func (*Worker) Queue ¶
func (w *Worker) Queue(job core.TaskMessage) error
Queue send notification to queue
func (*Worker) Request ¶
func (w *Worker) Request() (core.TaskMessage, error)
Request fetch new task from queue
func (*Worker) Stats ¶
func (w *Worker) Stats() *nsq.ConsumerStats
Stats retrieves the current connection and message statistics for a Consumer