rmqtool

package
v0.0.53 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeConsumer

func InitializeConsumer(config *RmqConfig, consumerConfig *ConsumerConfig)

func SetRLogLevelToError added in v0.0.30

func SetRLogLevelToError()

Types

type ConsumerConfig

type ConsumerConfig struct {
	Topic        string
	Tag          string
	Group        string // consumer group
	Order        bool   // fifo message
	ConsumerMode ConsumerMode
	MsgHandler   func(ctx context.Context, msgs ...*primitive.MessageExt) (consumer.ConsumeResult, error)
}

type ConsumerMode

type ConsumerMode int
const (
	SingleMode ConsumerMode = iota // 同樣group中的的consumer 只會有一個consumer收到訊息
	PubSubMode                     // pub/sub mode 用於水平擴展 group 中的所有consumer 都會收到同一條消息
)

type Rmq

type Rmq struct {
	Producer *rocketmq.Producer
}

func InitializePublisher

func InitializePublisher(config *RmqConfig) *Rmq

func (*Rmq) Send

func (rmq *Rmq) Send(msg *RmqMsg) error

func (*Rmq) SendAsync added in v0.0.32

func (rmq *Rmq) SendAsync(msg *RmqMsg) error

func (*Rmq) SendOneWay added in v0.0.51

func (rmq *Rmq) SendOneWay(msg *RmqMsg) error

type RmqConfig

type RmqConfig struct {
	NameServers []string
}

type RmqMsg

type RmqMsg struct {
	Topic string
	Tag   string
	Keys  []string
	Body  []byte
}

Jump to

Keyboard shortcuts

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