mq

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Direct string = "direct"
	Topic  string = "topic"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RabbitMQ

type RabbitMQ struct {
	QueueName string   // 队列名
	Exchange  string   // 交换机
	RouteKey  []string // 路由键
	Address   string   // 连接信息
	// contains filtered or unexported fields
}

func NewRabbitMQ

func NewRabbitMQ(queueName, exchange, address string, key []string) *RabbitMQ

func (*RabbitMQ) AddTopicRouteKey

func (r *RabbitMQ) AddTopicRouteKey(routes ...string) error

AddTopicRouteKey 增加路由键

func (*RabbitMQ) Close

func (r *RabbitMQ) Close()

Close 关闭MQ

func (*RabbitMQ) Consumer

func (r *RabbitMQ) Consumer(consumer string, callback func(<-chan amqp.Delivery)) error

Consumer 创建消费者

func (*RabbitMQ) DirectBind

func (r *RabbitMQ) DirectBind() error

DirectBind 使用路由键创建队列

func (*RabbitMQ) SendMessage

func (r *RabbitMQ) SendMessage(msg amqp.Publishing) error

SendMessage 通过指定的 routeKey 发送消息

func (*RabbitMQ) TopicBind

func (r *RabbitMQ) TopicBind() error

TopicBind 生成topic交换器

type RedisMQ

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

func NewRedisMq

func NewRedisMq(conf *gofkConfs.RedisConfig, opts ...RedisMqOpf) *RedisMQ

type RedisMqOpf

type RedisMqOpf func(options *RedisMqOptions)

func AddRedisMqTopic

func AddRedisMqTopic(topic string) RedisMqOpf

type RedisMqOptions

type RedisMqOptions struct {
	Topic    map[string]string // 路由键
	Address  string
	Password string
}

Jump to

Keyboard shortcuts

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