mirror of
https://github.com/fhmq/hmq.git
synced 2026-08-31 23:04:52 +00:00
upate plugin logic
This commit is contained in:
+9
-9
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
"github.com/fhmq/hmq/broker/lib/sessions"
|
||||
"github.com/fhmq/hmq/broker/lib/topics"
|
||||
"github.com/fhmq/hmq/plugins"
|
||||
"github.com/fhmq/hmq/plugins/bridge"
|
||||
|
||||
"github.com/eclipse/paho.mqtt.golang/packets"
|
||||
"go.uber.org/zap"
|
||||
@@ -217,10 +217,10 @@ func (c *client) processClientPublish(packet *packets.PublishPacket) {
|
||||
}
|
||||
|
||||
//publish kafka
|
||||
c.broker.Publish(&plugins.Elements{
|
||||
c.broker.Publish(&bridge.Elements{
|
||||
ClientID: c.info.clientID,
|
||||
Username: c.info.username,
|
||||
Action: plugins.Publish,
|
||||
Action: bridge.Publish,
|
||||
Timestamp: time.Now().Unix(),
|
||||
Payload: string(packet.Payload),
|
||||
Topic: topic,
|
||||
@@ -278,10 +278,10 @@ func (c *client) processClientSubscribe(packet *packets.SubscribePacket) {
|
||||
continue
|
||||
}
|
||||
|
||||
b.Publish(&plugins.Elements{
|
||||
b.Publish(&bridge.Elements{
|
||||
ClientID: c.info.clientID,
|
||||
Username: c.info.username,
|
||||
Action: plugins.Subscribe,
|
||||
Action: bridge.Subscribe,
|
||||
Timestamp: time.Now().Unix(),
|
||||
Topic: topic,
|
||||
})
|
||||
@@ -361,10 +361,10 @@ func (c *client) processClientUnSubscribe(packet *packets.UnsubscribePacket) {
|
||||
{
|
||||
//publish kafka
|
||||
|
||||
b.Publish(&plugins.Elements{
|
||||
b.Publish(&bridge.Elements{
|
||||
ClientID: c.info.clientID,
|
||||
Username: c.info.username,
|
||||
Action: plugins.Unsubscribe,
|
||||
Action: bridge.Unsubscribe,
|
||||
Timestamp: time.Now().Unix(),
|
||||
Topic: topic,
|
||||
})
|
||||
@@ -412,10 +412,10 @@ func (c *client) Close() {
|
||||
c.status = Disconnected
|
||||
|
||||
b := c.broker
|
||||
b.Publish(&plugins.Elements{
|
||||
b.Publish(&bridge.Elements{
|
||||
ClientID: c.info.clientID,
|
||||
Username: c.info.username,
|
||||
Action: plugins.Disconnect,
|
||||
Action: bridge.Disconnect,
|
||||
Timestamp: time.Now().Unix(),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user