mqtt.go 443 字节
package mqtt

import (
	"fmt"
	pahomqtt "github.com/eclipse/paho.mqtt.golang"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/mqtt"
	"strconv"
	"time"
)

func Start(){
	mqtt.StartSubscribe("test", func(client pahomqtt.Client, message pahomqtt.Message) {
		fmt.Println(time.Now(),"Topic:"+message.Topic()+" MessageId:"+ strconv.Itoa(int(message.MessageID()))+" Message:"+ string(message.Payload()))
	})
}