Documentation ¶
Index ¶
- func New(config map[string]interface{}) (interface{}, error)
- type ChannelBox
- type Client
- func (c *Client) Consume(parameter *ConsumeData) (<-chan amqp.Delivery, error)
- func (c *Client) DecodeBody(d amqp.Delivery, ret interface{}) error
- func (c *Client) DecodeHeaders(d amqp.Delivery) *RabbitHeaders
- func (c *Client) FreeChannel() (*ChannelBox, error)
- func (c *Client) GetConsumeChannelBox(queueName string, opCodes []string, exchange *ExchangeData) (*ChannelBox, error)
- func (c *Client) Publish(parameter *PublishData, logId string) (bool, error)
- func (c *Client) SetExchangeDeclare(exchange *ExchangeData) error
- type ConnBox
- type ConsumeData
- type ExchangeData
- type Pool
- func (c *Pool) ExchangeType(exchangeType string) string
- func (c *Pool) GetServers() (servers []string)
- func (c *Pool) Init() error
- func (c *Pool) ServiceName(serviceName string) string
- func (c *Pool) SetExchangeName(v string)
- func (c *Pool) SetExchangeType(v string)
- func (c *Pool) SetLogger(logger logs.ILogger)
- func (c *Pool) SetMaxChannelNum(v int)
- func (c *Pool) SetMaxIdleChannel(v int)
- func (c *Pool) SetMaxWaitTime(v string) error
- func (c *Pool) SetPass(v string)
- func (c *Pool) SetProbeInterval(v string) error
- func (c *Pool) SetServers(v []interface{})
- func (c *Pool) SetServiceName(v string)
- func (c *Pool) SetTlsCert(v string)
- func (c *Pool) SetTlsCertKey(v string)
- func (c *Pool) SetTlsRootCAs(v string)
- func (c *Pool) SetUser(v string)
- type PublishData
- type RabbitHeaders
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
RabbitMq client component, support Publisher-Consumer configuration: components:
rabbitMq: tlsRootCAs:"" tlsCert: "" tlsCertKey: "" user: "guest" pass: "guest" exchangeName: "" exchangeType: "" maxChannelNum: 2000 maxIdleChannel: "200" maxIdleChannelTime:"10s" probeInterval: "0s" maxWaitTime: "200ms" serviceName: "pgo-xxx" servers: - "127.0.0.1:6379" - "127.0.0.1:6380"
Types ¶
type ChannelBox ¶
type ChannelBox struct {
// contains filtered or unexported fields
}
func (*ChannelBox) Close ¶
func (c *ChannelBox) Close(force bool) error
func (*ChannelBox) GetChannel ¶
func (c *ChannelBox) GetChannel() *amqp.Channel
type Client ¶
type Client struct {
Pool
}
func (*Client) Consume ¶
func (c *Client) Consume(parameter *ConsumeData) (<-chan amqp.Delivery, error)
func (*Client) DecodeHeaders ¶
func (c *Client) DecodeHeaders(d amqp.Delivery) *RabbitHeaders
func (*Client) FreeChannel ¶ added in v0.1.103
func (c *Client) FreeChannel() (*ChannelBox, error)
func (*Client) GetConsumeChannelBox ¶
func (c *Client) GetConsumeChannelBox(queueName string, opCodes []string, exchange *ExchangeData) (*ChannelBox, error)
func (*Client) Publish ¶
func (c *Client) Publish(parameter *PublishData, logId string) (bool, error)
func (*Client) SetExchangeDeclare ¶
func (c *Client) SetExchangeDeclare(exchange *ExchangeData) error
type ConsumeData ¶
type ExchangeData ¶ added in v0.1.99
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) ExchangeType ¶ added in v0.1.99
func (*Pool) GetServers ¶
func (*Pool) ServiceName ¶
func (*Pool) SetExchangeName ¶
func (*Pool) SetExchangeType ¶
func (*Pool) SetMaxChannelNum ¶
func (*Pool) SetMaxIdleChannel ¶
func (*Pool) SetMaxWaitTime ¶
func (*Pool) SetProbeInterval ¶
func (*Pool) SetServers ¶
func (c *Pool) SetServers(v []interface{})
func (*Pool) SetServiceName ¶
func (*Pool) SetTlsCert ¶
func (*Pool) SetTlsCertKey ¶
func (*Pool) SetTlsRootCAs ¶
type PublishData ¶
type PublishData struct { DeliveryMode uint8 // Transient (0 or 1) or Persistent (2) ServiceName string // 服务名 ExChange *ExchangeData OpCode string // 操作code 和queue绑定相关 OpUid string // 操作用户id 可以为空 ContentType string // 内容类型 默认为:"text/plain" Data interface{} // 发送数据 }
rabbit 发布结构
Click to show internal directories.
Click to hide internal directories.