Documentation ¶
Index ¶
- Constants
- func Debug(enable bool)
- func Publish(messages chan Message, c *Client)
- func PublishWithRoutingKey(messages chan MessageWithRoutingKey, c *Client)
- func SetUserDebug(f TraceFunc)
- func Subscribe(handle CallBack, c *Client)
- func TraceError(format string, v ...interface{})
- func TraceInfo(format string, v ...interface{})
- type CallBack
- type Client
- func (c *Client) GetPublishStatus() bool
- func (c *Client) Identity() string
- func (c *Client) Info()
- func (c *Client) SetDeliveryMode(dMode uint8)
- func (c *Client) SetExchange(ex, exType string)
- func (c *Client) SetExchangeEnable(enable bool)
- func (c *Client) SetExpirationTime(time int32)
- func (c *Client) SetMsgExpirationEnable(enable bool)
- func (c *Client) SetPublishStatus(status bool)
- func (c *Client) SetQos(qos int)
- func (c *Client) SetQueueBindEnable(enable bool)
- func (c *Client) SetQueueDurable(durable bool)
- func (c *Client) SetQueueName(qName string)
- func (c *Client) SetQueueType(qType string)
- func (c *Client) SetRoutingKey(rkey string)
- func (c *Client) SetURL(url, vhost, username, password string)
- func (c *Client) SettQueuAutoDelete(auto bool)
- type Message
- type MessageWithRoutingKey
- type Session
- type TraceFunc
Constants ¶
const ( ExchangeDirect = "direct" ExchangeFanout = "fanout" ExchangeTopic = "topic" ExchangeHeaders = "headers" )
Constants for standard AMQP 0-9-1 exchange types.
const ( Transient uint8 = 1 Persistent uint8 = 2 )
DeliveryMode Transient means higher throughput but messages will not be restored on broker restart. The delivery mode of publishings is unrelated to the durability of the queues they reside on. Transient messages will not be restored to durable queues, persistent messages will be restored to durable queues and lost on non-durable queues during server restart.
This remains typed as uint8 to match Publishing.DeliveryMode. Other delivery modes specific to custom queue implementations are not enumerated here.
const ( QueueTypeClassic = "classic" QueueTypeQuorum = "quorum" QueueTypeStream = "stream" )
QueueType Classic queues are the standard queue type in RabbitMQ. They are backed by memory and disk, and can be replicated across a cluster of brokers. Quorum queues are replicated across a cluster of brokers, and are designed to be more durable than classic queues. They are backed by Raft, and are designed to be more resilient to network partitions and broker failures. Stream queues are append-only logs that are replicated across a cluster of brokers. They are designed for high-throughput, low-latency use cases.
const ( LevelEmergency = iota LevelAlert LevelCritical LevelError LevelWarning LevelNotice LevelInformational LevelDebug )
Variables ¶
This section is empty.
Functions ¶
func PublishWithRoutingKey ¶
func PublishWithRoutingKey(messages chan MessageWithRoutingKey, c *Client)
PublishWithRoutingKey rabbitmq publish
Types ¶
type Client ¶
type Client struct { URL string // rmqurl used to connect rabbitmq services ExchangeEnable bool // enable or disable queue bind Exchange string // exchange binds the publishers to the subscribers ExchangeType string // type of exchange QueueBindEnable bool // enable or disable queue bind QueueName string // name of queue QueueType string // type of queue, classic/quorum/stream QueueDurable bool // durable queue QueueAutoDelete bool // auto delete queue RoutingKey string // routing key of queue Qos int // qos of subscribe MsgExpirationEnable bool // enable or disable message expiration ExpirationTime int32 // expiration time of message DeliveryMode uint8 // delivery mode of message PublishStatus bool // publish status }
Client rabbitmq客户端信息
func (*Client) Identity ¶
Identity returns the same host/process unique string for the lifetime of this process so that subscriber reconnections reuse the same queue name.
func (*Client) SetDeliveryMode ¶
SetDeliveryMode 设置消息投递模式
func (*Client) SetExchangeEnable ¶
SetExchangeEnable 设置是否需要定义交换器
func (*Client) SetExpirationTime ¶
SetExpirationTime 设置消息过期时间, 单位ms
func (*Client) SetMsgExpirationEnable ¶
SetMsgExpirationEnable 设置消息是否过期
func (*Client) SetPublishStatus ¶
SetPublishStatus 设置生产者状态
func (*Client) SetQueueBindEnable ¶
SetQueueBindEnable 设置是否需要声明和绑定到交换器
func (*Client) SetQueueDurable ¶ added in v1.1.1
SetQueueDurable 设置队列是否持久化
func (*Client) SetQueueType ¶ added in v1.1.1
SetQueueType 设置队列类型
func (*Client) SetRoutingKey ¶
SetRoutingKey 设置routingKey
func (*Client) SettQueuAutoDelete ¶ added in v1.1.1
SettQueuAutoDelete 设置是否自动删除队列
type Message ¶
type Message []byte
Message is the application type for a message. This can contain identity, or a reference to the recevier chan for further demuxing.
type MessageWithRoutingKey ¶
MessageWithRoutingKey is the application type for a message with routing key