emqxexhook事件消息
挂载点
名称说明执⾏时机
client.disconnected连接断开客户端连接层在准备关闭时
client.authenticate连接认证执⾏完 t 后
client.check_acl ACL 鉴权执⾏ 发布/订阅 操作前
client.subscribe订阅主题收到订阅报⽂后,执⾏ client.check_acl 鉴权前
client.unsubscribe取消订阅收到取消订阅报⽂后
session.subscribed会话订阅主题完成订阅操作后
session.unsubscribed会话取消订阅完成取消订阅操作后sumed会话恢复ted 执⾏完成,且成功恢复旧的会话信息后session.discarded会话被移除会话由于被移除⽽终⽌后
session.takeovered会话被接管会话由于被接管⽽终⽌后
message.publish消息发布服务端在发布(路由)消息前
message.delivered消息投递消息准备投递到客户端前
message.acked消息回执服务端在收到客户端发回的消息 ACK 后
message.dropped消息丢弃发布出的消息被丢弃后onProviderLoaded
request: broker {
version: "4.3.9-cc7b1aa9"
sysdescr: "EMQ X"
uptime: "0 seconds"
datetime: "2021-12-01 09:07:32"
}
onClientConnect 处理连接报⽂
request: conninfo {
node: "emqx@127.0.0.1"
clientid: "client-0"
username: "emqx_test"
peerhost: "127.0.0.1"
sockport: 1883
proto_name: "MQTT"
proto_ver: "4"
keepalive: 20
}
onClientAuthenticate 连接认证
request: clientinfo {
node: "emqx@127.0.0.1"
clientid: "client-0"
username: "emqx_test"
password: "emqx_test_password"
peerhost: "127.0.0.1"
sockport: 1883
protocol: "mqtt"
anonymous: true
}
result: true
onClientConnack 下发连接应答
request: conninfo {
node: "emqx@127.0.0.1"
clientid: "client-0"
username: "emqx_test"
peerhost: "127.0.0.1"
sockport: 1883
proto_name: "MQTT"
proto_ver: "4"
keepalive: 20
}emqx broker
result_code: "success" onClientConnected 成功接⼊
request: clientinfo {
node: "emqx@127.0.0.1"
clientid: "client-0"
username: "emqx_test"
peerhost: "127.0.0.1"
sockport: 1883
protocol: "mqtt"
}
onSessionCreated 会话创建
request: clientinfo {
node: "emqx@127.0.0.1"
clientid: "client-0"
username: "emqx_test"
peerhost: "127.0.0.1"
sockport: 1883
protocol: "mqtt"
}
onClientCheckAcl ACL 鉴权
request: clientinfo {
node: "emqx@127.0.0.1"
clientid: "client-0"
username: "emqx_test"
peerhost: "127.0.0.1"
sockport: 1883
protocol: "mqtt"
}
type: SUBSCRIBE
topic: "testtopic/1"
result: true
onClientSubscribe 订阅主题
request: clientinfo {
node: "emqx@127.0.0.1"
clientid: "client-0"
username: "emqx_test"
peerhost: "127.0.0.1"
sockport: 1883
protocol: "mqtt"
}
topic_filters {
name: "testtopic/1"
qos: 1
}
onSessionSubscribed 会话订阅主题
request: clientinfo {
node: "emqx@127.0.0.1"
clientid: "client-0"
username: "emqx_test"
peerhost: "127.0.0.1"
sockport: 1883
protocol: "mqtt"
}
topic: "testtopic/1"
subopts {
qos: 1
}
onMessagePublish 消息发布
request: message {
node: "emqx@127.0.0.1"
id: "0005D20B5F22B6A8F49D0000028C0001"
qos: 1
from: "proceduer"
topic: "testtopic/1"
payload: "test"
timestamp: 1638321166137
}
onMessageDelivered 消息投递
request: clientinfo {
node: "emqx@127.0.0.1"
clientid: "proceduer"
username: "emqx_test"
peerhost: "127.0.0.1"
sockport: 1883
protocol: "mqtt"
}
message {
node: "emqx@127.0.0.1"
id: "0005D20B5F22B6A8F49D0000028C0001"
from: "proceduer"
topic: "testtopic/1"
payload: "hardcode payload by exhook-svr-java :)"
timestamp: 1638321166137
}
onClientDisconnected 断开链接
request: clientinfo {
node: "emqx@127.0.0.1"
clientid: "client-0"
username: "emqx_test"
peerhost: "127.0.0.1"
sockport: 1883
protocol: "mqtt"
}
reason: "normal" onSessionTerminated 会话终⽌
request: clientinfo {
node: "emqx@127.0.0.1"
clientid: "client-0"
username: "emqx_test"
peerhost: "127.0.0.1"
sockport: 1883
protocol: "mqtt"
}
reason: "{shutdown,normal}"

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。