RabbitMQ

package
v0.0.0-...-70261f9 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MQURL = "amqp://guest:guest@localhost:5672/"

连接信息

Variables

This section is empty.

Functions

This section is empty.

Types

type RabbitMQ

type RabbitMQ struct {

	//队列名称
	QueueName string
	//交换机名称
	Exchange string
	//bind Key 名称
	Key string
	//连接信息
	Mqurl string
	// contains filtered or unexported fields
}

rabbitMQ结构体

func NewRabbitMQ

func NewRabbitMQ(queueName string, exchange string, key string) *RabbitMQ

创建结构体实例

func NewRabbitMQTopic

func NewRabbitMQTopic(exchangeName string, routingKey string) *RabbitMQ

话题模式 创建RabbitMQ实例

func (*RabbitMQ) Destory

func (r *RabbitMQ) Destory()

断开channel 和 connection

func (*RabbitMQ) PublishTopic

func (r *RabbitMQ) PublishTopic(message string)

话题模式发送消息

func (*RabbitMQ) ReceiveTopic

func (r *RabbitMQ) ReceiveTopic()

话题模式接受消息 要注意key,规则 其中“*”用于匹配一个单词,“#”用于匹配多个单词(可以是零个) 匹配 kuteng.* 表示匹配 kuteng.hello, kuteng.hello.one需要用kuteng.#才能匹配到

Jump to

Keyboard shortcuts

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