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) SetQueueName(q string)
- func (c *Client) SetRoutingKey(rkey string)
- func (c *Client) SetURL(url, vhost, username, password string)
- 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 ( 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 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) SetRoutingKey ¶
SetRoutingKey 设置routingKey
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