nats

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Worker)

Option for queue system

func WithAddr

func WithAddr(addr string) Option

WithAddr setup the addr of NATS

func WithLogger

func WithLogger(l queue.Logger) Option

WithLogger set custom logger

func WithQueue

func WithQueue(queue string) Option

WithQueue setup the queue of NATS

func WithRunFunc

func WithRunFunc(fn func(context.Context, queue.QueuedMessage) error) Option

WithRunFunc setup the run func of queue

func WithSubj

func WithSubj(subj string) Option

WithSubj setup the subject of NATS

type Worker

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

Worker for NSQ

func NewWorker

func NewWorker(opts ...Option) *Worker

NewWorker for struc

func (*Worker) AfterRun

func (s *Worker) AfterRun() error

AfterRun run script after start worker

func (*Worker) BeforeRun

func (s *Worker) BeforeRun() error

BeforeRun run script before start worker

func (*Worker) Capacity

func (s *Worker) Capacity() int

Capacity for channel

func (*Worker) Queue

func (s *Worker) Queue(job queue.QueuedMessage) error

Queue send notification to queue

func (*Worker) Run

func (s *Worker) Run() error

Run start the worker

func (*Worker) Shutdown

func (s *Worker) Shutdown() error

Shutdown worker

func (*Worker) Usage

func (s *Worker) Usage() int

Usage for count of channel usage

Jump to

Keyboard shortcuts

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