mq

package
v1.2.1-beta1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 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 HandlerFunc

type HandlerFunc func(message *Message) error

func (HandlerFunc) HandlerMessage

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

HandlerMessage implements the Handler interface

type MQ

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

MQ message platform

func NewConsumer

func NewConsumer(topic, channel string, params ...any) (mq MQ)

NewConsumer new consumer

func NewProducer

func NewProducer(params ...any) (mq MQ)

NewProducer new producer

type Message

type Message struct {
	*nsq.Message
}

type Nsg

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

Nsg nsq

func (*Nsg) MultiPub

func (n *Nsg) MultiPub(topic string, msgs ...any) error

func (*Nsg) NewConsumer

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

func (*Nsg) NewProducer

func (n *Nsg) NewProducer() MQ

func (*Nsg) Pub

func (n *Nsg) Pub(topic string, msg any) error

func (*Nsg) Stop

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