nsq

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: 8 Imported by: 0

README

NSQ

A realtime distributed messaging platform

Setup

start the NSQ lookupd

nsqlookupd

start the NSQ server

nsqd --lookupd-tcp-address=localhost:4160

start the NSQ admin dashboard

nsqadmin --lookupd-http-address localhost:4161

Testing

go test -v ./...

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 NSQ

func WithChannel

func WithChannel(channel string) Option

WithChannel setup the channel of NSQ

func WithLogger

func WithLogger(l queue.Logger) Option

WithLogger set custom logger

func WithMaxInFlight

func WithMaxInFlight(num int) Option

WithMaxInFlight Maximum number of messages to allow in flight (concurrency knob)

func WithRunFunc

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

WithRunFunc setup the run func of queue

func WithTopic

func WithTopic(topic string) Option

WithTopic setup the topic of NSQ

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