rabbitmq

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindInfo added in v0.0.10

type BindInfo struct {
	Exchange  string
	QueueName string
	RouterKey string
	Qos       int
}

基本的一个绑定信息

type RabbitMQ

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

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

func New

func New(connect string, qos int) *RabbitMQ

New 创建一个新的操作RabbitMQ的对象

func (*RabbitMQ) RegisterReceiver

func (mq *RabbitMQ) RegisterReceiver(receiver Receiver)

RegisterReceiver 注册一个用于接收指定队列指定路由的数据接收者

func (*RabbitMQ) Start

func (mq *RabbitMQ) Start()

Start 启动Rabbitmq的客户端

type ReceiveCall

type ReceiveCall func([]byte) bool

type Receiver

type Receiver interface {
	GetBindInfo() BindInfo // 获取绑定信息
	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