msg

package
v1.30.32 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerFunc

type HandlerFunc func(message *Message) error

func (HandlerFunc) HandlerMessage

func (h HandlerFunc) HandlerMessage(message *Message) error

HandlerMessage implements the Handler interface

type Message

type Message struct {
	*nsq.Message
}

type Msg

type Msg interface {
	NewProducer() Msg                                 // new producer
	NewConsumer(topic, channel string) Msg            // new consumer
	Stop()                                            // consumer Stop
	Pub(topic string, msg interface{}) error          // pub interface{} message
	MultiPub(topic string, msgs ...interface{}) error // MultiPub ...interface{} message
	Sub(handler HandlerFunc) error                    // sub func to handle your work
}

Msg message platform

func NewConsumer

func NewConsumer(topic, channel string, params ...interface{}) (msg Msg)

NewConsumer new consumer

func NewProducer

func NewProducer(params ...interface{}) (msg Msg)

NewProducer new producer

type Nsg

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

Nsg nsq

func (*Nsg) MultiPub

func (n *Nsg) MultiPub(topic string, msgs ...interface{}) error

func (*Nsg) NewConsumer

func (n *Nsg) NewConsumer(topic, channel string) Msg

func (*Nsg) NewProducer

func (n *Nsg) NewProducer() Msg

func (*Nsg) Pub

func (n *Nsg) Pub(topic string, msg interface{}) error

func (*Nsg) Stop added in v1.30.9

func (n *Nsg) Stop()

func (*Nsg) Sub

func (n *Nsg) Sub(handler HandlerFunc) error

Jump to

Keyboard shortcuts

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