nsq

package
v0.0.0-...-e6d59a1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const TOPIC_DLQ_SUFFIX = "-dlq"

Variables

This section is empty.

Functions

func HelperFor

func HelperFor(message *nsq.Message) (*helper, error)

func NewNsq

func NewNsq(conf NsqConf) *nsqClient

Types

type Channel

type Channel = string

type ChannelProcessorMap

type ChannelProcessorMap = map[Channel]queue.JobProcessor

type ConsumerPool

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

func (*ConsumerPool) RegisterProcessor

func (c *ConsumerPool) RegisterProcessor(topic string, channel string, processor queue.JobProcessor, concurrency int, dlq queue.Dlqer) error

func (*ConsumerPool) Stop

func (c *ConsumerPool) Stop()

type NsqClient

type NsqClient interface {
	service.Service

	Context() context.Context
	SetProcessor(jobTopicChannelMapWithProcessor map[Topic]ChannelProcessorMap)
	Push(job *queue.Job) error
}

type NsqConf

type NsqConf struct {
	Sender SenderConf
	Worker WorkerConf
}

docker exec -it faktory_container_name redis-cli -s /var/lib/faktory/db/redis.sock

type ProducerPool

type ProducerPool struct {
	sync.Mutex // 互斥锁保护以下字段
	// contains filtered or unexported fields
}

func (*ProducerPool) Publish

func (p *ProducerPool) Publish(topic string, delay time.Duration, message []byte) error

func (*ProducerPool) Stop

func (p *ProducerPool) Stop()

type SenderConf

type SenderConf struct {
	NsqdAddrs []string // []string{"127.0.0.1:4150"}
}

type Topic

type Topic = string

type WorkerConf

type WorkerConf struct {
	NsqLookupdAddrs []string // []string{"127.0.0.1:4160"}

	MaxInFlight int `json:",default=50"`

	PullFromQueuesWithPriority map[string]int `json:",default={\"default\":1}"` // {"critical":3, "default":2, "bulk":1}
}

Jump to

Keyboard shortcuts

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