Documentation ¶
Index ¶
- Variables
- func NewMQ() mq.IReactMQ
- type ReactMQTT
- func (this *ReactMQTT) Close()
- func (this *ReactMQTT) Connect(mode mq.Mode, strURL string) (err error)
- func (this *ReactMQTT) Consume(strBindingKey, strQueueName string, handler mq.ReactHandler) (err error)
- func (this *ReactMQTT) Debug(enable bool)
- func (this *ReactMQTT) GetAdapter() (adapter mq.Adapter)
- func (this *ReactMQTT) IsClosed() bool
- func (this *ReactMQTT) NewTLSConfig(ca, key, crt string) *tls.Config
- func (this *ReactMQTT) OnConnect(Client MQTT.Client)
- func (this *ReactMQTT) OnDisconnect(Client MQTT.Client, err error)
- func (this *ReactMQTT) OnReceive(client MQTT.Client, msg MQTT.Message)
- func (this *ReactMQTT) Publish(strBindingKey, strQueueName, key string, value string) (err error)
- func (this *ReactMQTT) Reconnect() (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var PARAM_CLIENT_ID = "client-id"
View Source
var PARAM_TLS = "tls"
View Source
var PARAM_TLS_CA = "ca"
View Source
var PARAM_TLS_CER = "cer"
View Source
var PARAM_TLS_KEY = "key"
View Source
var TLS_IS_ENABLE = "true"
Functions ¶
Types ¶
type ReactMQTT ¶
type ReactMQTT struct {
// contains filtered or unexported fields
}
func (*ReactMQTT) Connect ¶
* @brief MQ服务器连接接口定义 * @param strUrl 连接服务器URL( 格式规范 mqtt://username:password@host:port[/config?tls=[true|false]&&ca=ca.crt&key=client.key&cer=client.crt&client-id=MyClientID] ) * @return err 连接失败返回具体错误信息
func (*ReactMQTT) Consume ¶
func (this *ReactMQTT) Consume(strBindingKey, strQueueName string, handler mq.ReactHandler) (err error)
* @brief 消息消费接口定义 * @param strBindingKey 队列绑定Key * @param strQueueName 队列名称 * @param handler 消费回调处理对象 * @return err 成功返回nil,失败返回返回具体错误信息 * @remark 服务器异常或重启时内部会自动重连服务器
func (*ReactMQTT) GetAdapter ¶ added in v1.0.9
* @brief 获取当前MQ类型 * @param adapter MQ类型
func (*ReactMQTT) IsClosed ¶
* @brief 判定是否MQ服务器断开连接(异常宕机或重启) * @param * @return 远程服务器连接断开返回true,否则返回false
func (*ReactMQTT) NewTLSConfig ¶
func (*ReactMQTT) OnDisconnect ¶
MQTT 服务器断开连接回调
Click to show internal directories.
Click to hide internal directories.