rabbitmq

package
v1.3.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ExchangeXDelayedMessage = "x-delayed-message"

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Conn *amqp.Connection
}

Connection RabbitMQ连接

func NewConnection

func NewConnection(url string) (conn Connection, err error)

NewConnection 实例化RabbitMQ连接

func (Connection) DelayedTypeReceive

func (conn Connection) DelayedTypeReceive(data DelayedTypeReceiveData) (messages <-chan amqp.Delivery, ch *amqp.Channel, err error)

func (Connection) DelayedTypeSend added in v1.0.9

func (conn Connection) DelayedTypeSend(data DelayedTypeSendData) (err error)

func (Connection) Receive

func (conn Connection) Receive(data ReceiveData) (messages <-chan amqp.Delivery, ch *amqp.Channel, err error)

Receive 接收消息队列

func (Connection) RoutingTypeReceive

func (conn Connection) RoutingTypeReceive(data RoutingTypeReceiveData) (messages <-chan amqp.Delivery, ch *amqp.Channel, err error)

func (Connection) RoutingTypeSend added in v1.0.9

func (conn Connection) RoutingTypeSend(data RoutingTypeSendData) (err error)

func (Connection) Send added in v1.0.9

func (conn Connection) Send(data SendData) (err error)

Send 发送消息队列

func (Connection) SubscribeTypeReceive

func (conn Connection) SubscribeTypeReceive(data SubscribeTypeReceiveData) (messages <-chan amqp.Delivery, ch *amqp.Channel, err error)

func (Connection) SubscribeTypeSend added in v1.0.9

func (conn Connection) SubscribeTypeSend(data SubscribeTypeSendData) (err error)

func (Connection) TopicTypeReceive

func (conn Connection) TopicTypeReceive(data TopicTypeReceiveData) (messages <-chan amqp.Delivery, ch *amqp.Channel, err error)

func (Connection) TopicTypeSend added in v1.0.9

func (conn Connection) TopicTypeSend(data TopicTypeSendData) (err error)

func (Connection) WorkTypeReceive

func (conn Connection) WorkTypeReceive(data WorkTypeReceiveData) (messages <-chan amqp.Delivery, ch *amqp.Channel, err error)

func (Connection) WorkTypeSend added in v1.0.9

func (conn Connection) WorkTypeSend(data WorkTypeSendData) (err error)

type DelayedTypeReceiveData added in v1.0.0

type DelayedTypeReceiveData struct {
	Exchange                  string     `json:"exchange"`
	QueueName                 string     `json:"queue_name"`
	RoutingKey                string     `json:"routing_key"`
	AutoAck                   bool       `json:"auto_ack"`
	ExchangeDeclareArgs       amqp.Table `json:"exchange_declare_args"`
	QueueDeclareArgs          amqp.Table `json:"queue_declare_args"`
	QueueBindArgs             amqp.Table `json:"queue_bind_args"`
	ExchangeDeclareAutoDelete bool       `json:"exchange_declare_auto_delete"`
	ExchangeDeclareDurable    bool       `json:"exchange_declare_durable"`  // true
	QueueDeclareDurable       bool       `json:"queue_declare_durable"`     // true
	QueueDeclareAutoDelete    bool       `json:"queue_declare_auto_delete"` // true
}

type DelayedTypeSendData added in v1.0.9

type DelayedTypeSendData struct {
	Exchange               string          `json:"exchange"`
	RoutingKey             string          `json:"routing_key"`
	Publishing             amqp.Publishing `json:"publishing"`
	ExchangeDeclareArgs    amqp.Table      `json:"exchange_declare_args"`
	ExchangeDeclareDurable bool            `json:"exchange_declare_durable"` // true
}

type Queue added in v1.0.10

type Queue interface {
	Send(data SendData) (err error)
	Receive(data ReceiveData) (messages <-chan amqp.Delivery, ch *amqp.Channel, err error)
}

Queue 队列接口

type ReceiveData

type ReceiveData struct {
	Exchange                  string     `json:"exchange"`
	Type                      string     `json:"type"`
	ExchangeDeclareDurable    bool       `json:"exchange_declare_durable"`
	QueueDeclareDurable       bool       `json:"queue_declare_durable"`
	ExchangeDeclareAutoDelete bool       `json:"exchange_declare_auto_delete"`
	QueueDeclareAutoDelete    bool       `json:"queue_declare_auto_delete"`
	Internal                  bool       `json:"internal"`
	NoWait                    bool       `json:"no_wait"`
	Exclusive                 bool       `json:"exclusive"`
	QueueName                 string     `json:"queue_name"`
	RoutingKey                string     `json:"routing_key"`
	Consumer                  string     `json:"consumer"`
	AutoAck                   bool       `json:"auto_ack"`
	NoLocal                   bool       `json:"no_local"`
	QosPrefetchCount          int        `json:"qos_prefetch_count"`
	QosPrefetchSize           int        `json:"qos_prefetch_size"`
	QosGlobal                 bool       `json:"qos_global"`
	ExchangeDeclareArgs       amqp.Table `json:"exchange_declare_args"`
	QueueDeclareArgs          amqp.Table `json:"queue_declare_args"`
	QueueBindArgs             amqp.Table `json:"queue_bind_args"`
	ConsumeArgs               amqp.Table `json:"consume_args"`
}

ReceiveData 接收处理队列所提交数据

type RoutingTypeReceiveData added in v1.0.0

type RoutingTypeReceiveData struct {
	Exchange               string     `json:"exchange"`
	RoutingKey             string     `json:"routing_key"`
	AutoAck                bool       `json:"auto_ack"`
	ExchangeDeclareArgs    amqp.Table `json:"exchange_declare_args"`
	QueueDeclareArgs       amqp.Table `json:"queue_declare_args"`
	QueueBindArgs          amqp.Table `json:"queue_bind_args"`
	QueueDeclareDurable    bool       `json:"queue_declare_durable"`
	ExchangeDeclareDurable bool       `json:"exchange_declare_durable"` // true
	Exclusive              bool       `json:"exclusive"`                // true
}

type RoutingTypeSendData added in v1.0.9

type RoutingTypeSendData struct {
	Exchange               string          `json:"exchange"`
	RoutingKey             string          `json:"routing_key"`
	Publishing             amqp.Publishing `json:"publishing"`
	ExchangeDeclareArgs    amqp.Table      `json:"exchange_declare_args"`
	ExchangeDeclareDurable bool            `json:"exchange_declare_durable"` // true
}

type SendData added in v1.0.9

type SendData struct {
	Exchange               string          `json:"exchange"`
	Type                   string          `json:"type"`
	QueueName              string          `json:"queue_name"`
	RoutingKey             string          `json:"routing_key"`
	ExchangeDeclareArgs    amqp.Table      `json:"exchange_declare_args"`
	QueueDeclareArgs       amqp.Table      `json:"queue_declare_args"`
	AutoDelete             bool            `json:"auto_delete"`
	Internal               bool            `json:"internal"`
	NoWait                 bool            `json:"no_wait"`
	Exclusive              bool            `json:"exclusive"`
	Mandatory              bool            `json:"mandatory"`
	Immediate              bool            `json:"immediate"`
	Publishing             amqp.Publishing `json:"publishing"`
	ExchangeDeclareDurable bool            `json:"exchange_declare_durable"`
	QueueDeclareDurable    bool            `json:"queue_declare_durable"`
}

SendData 发送消息队列所提交数据

type SubscribeTypeReceiveData added in v1.0.0

type SubscribeTypeReceiveData struct {
	Exchange               string     `json:"exchange"`
	AutoAck                bool       `json:"auto_ack"`
	ExchangeDeclareArgs    amqp.Table `json:"exchange_declare_args"`
	QueueDeclareArgs       amqp.Table `json:"queue_declare_args"`
	QueueBindArgs          amqp.Table `json:"queue_bind_args"`
	ExchangeDeclareDurable bool       `json:"exchange_declare_durable"` // true
	QueueDeclareDurable    bool       `json:"queue_declare_durable"`
}

type SubscribeTypeSendData added in v1.0.9

type SubscribeTypeSendData struct {
	Exchange               string          `json:"exchange"`
	ExchangeDeclareDurable bool            `json:"exchange_declare_durable"` // true
	Publishing             amqp.Publishing `json:"publishing"`
	ExchangeDeclareArgs    amqp.Table      `json:"exchange_declare_args"`
}

type TopicTypeReceiveData added in v1.0.0

type TopicTypeReceiveData struct {
	Exchange               string     `json:"exchange"`
	RoutingKey             string     `json:"routing_key"`
	AutoAck                bool       `json:"auto_ack"`
	ExchangeDeclareArgs    amqp.Table `json:"exchange_declare_args"`
	QueueDeclareArgs       amqp.Table `json:"queue_declare_args"`
	QueueBindArgs          amqp.Table `json:"queue_bind_args"`
	QueueDeclareDurable    bool       `json:"queue_declare_durable"`
	ExchangeDeclareDurable bool       `json:"exchange_declare_durable"` // true
	Exclusive              bool       `json:"exclusive"`                // true
}

type TopicTypeSendData added in v1.0.9

type TopicTypeSendData struct {
	Exchange               string          `json:"exchange"`
	RoutingKey             string          `json:"routing_key"`
	Publishing             amqp.Publishing `json:"publishing"`
	ExchangeDeclareArgs    amqp.Table      `json:"exchange_declare_args"`
	ExchangeDeclareDurable bool            `json:"exchange_declare_durable"` // true
}

type WorkTypeReceiveData added in v1.0.0

type WorkTypeReceiveData struct {
	QueueName           string     `json:"queue_name"`
	RoutingKey          string     `json:"routing_key"`
	AutoAck             bool       `json:"auto_ack"`
	QosPrefetchCount    int        `json:"qos_prefetch_count"`
	QosPrefetchSize     int        `json:"qos_prefetch_size"`
	QosGlobal           bool       `json:"qos_global"`
	QueueDeclareArgs    amqp.Table `json:"queue_declare_args"`
	ConsumeArgs         amqp.Table `json:"consume_args"`
	QueueDeclareDurable bool       `json:"queue_declare_durable"` // true
}

type WorkTypeSendData added in v1.0.9

type WorkTypeSendData struct {
	QueueName           string          `json:"queue_name"`
	RoutingKey          string          `json:"routing_key"`
	QueueDeclareArgs    amqp.Table      `json:"queue_declare_args"`
	QueueDeclareDurable bool            `json:"queue_declare_durable"` // true
	Publishing          amqp.Publishing `json:"publishing"`
}

Jump to

Keyboard shortcuts

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