rabbitmq

package
v0.0.0-...-7540414 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 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 MQExchangType

type MQExchangType string
const (
	MQ_EXCHANGE_DIRECT MQExchangType = "direct"
	MQ_EXCHANGE_TOPIC  MQExchangType = "topic"
	MQ_EXCHANGE_HEADER MQExchangType = "headers"
	MQ_EXCHANGE_FANOUT MQExchangType = "fanout"
)

type RabbitMQ

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

RabbitMQ 用于管理和维护rabbitmq的对象

func (*RabbitMQ) Push

func (this *RabbitMQ) Push(queque string, msg interface{})

func (*RabbitMQ) RegisterReceiver

func (this *RabbitMQ) RegisterReceiver(r Receiver)

func (*RabbitMQ) Start

func (this *RabbitMQ) Start()

type RabbitMQConnect

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

func (*RabbitMQConnect) Close

func (this *RabbitMQConnect) Close()

func (*RabbitMQConnect) Connect

func (this *RabbitMQConnect) Connect(mqurl string)

func (*RabbitMQConnect) GetChannel

func (this *RabbitMQConnect) GetChannel() *amqp.Channel

func (*RabbitMQConnect) NewClient

func (this *RabbitMQConnect) NewClient(exchangeName string, exchangeType MQExchangType) *RabbitMQ

func (*RabbitMQConnect) SetLogger

func (this *RabbitMQConnect) SetLogger(l log.Log)

type Receiver

type Receiver interface {
	QueueName() string     // 获取接收者需要监听的队列
	RouterKey() string     // 这个队列绑定的路由
	OnError(error)         // 处理遇到的错误,当RabbitMQ对象发生了错误,他需要告诉接收者处理错误
	OnReceive([]byte) bool // 处理收到的消息, 这里需要告知RabbitMQ对象消息是否处理成功
}

Receiver 观察者模式需要的接口 观察者用于接收指定的queue到来的数据

Jump to

Keyboard shortcuts

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