Documentation ¶
Overview ¶
Package mqtt implements reusable logic for mqtt connections for tempus edge applications.
Security and mqtt client connectivity is implemented here, but application logic is left to the package of specific tempus edge applications.
Index ¶
- Variables
- func Init(inboxSize, outboxSize int)
- func PublishJSONDataMessage(msg *proto.JsonDataMessage) error
- func PublishJSONString(json []byte)
- func PublishMQTTMessage(msg *proto.MqttMessage) (err error)
- func PublishOPCMessage(msg *proto.OpcMessage) error
- func Update(mqttConfig *proto.MqttConfig) error
Constants ¶
This section is empty.
Variables ¶
var Inbox chan *proto.MqttMessage
Inbox holds incoming mqtt messages from the broker
var Outbox chan *proto.MqttMessage
Outbox holds outgoing mqtt messages to the broker
Functions ¶
func Init ¶
func Init(inboxSize, outboxSize int)
Init does the following: - creates Inbox and Outbox channels - starts a go routine for draining the Outbox
@param inboxSize - int size of the Inbox channel @param outboxSize - int size of the Outbox channel
func PublishJSONDataMessage ¶
func PublishJSONDataMessage(msg *proto.JsonDataMessage) error
PublishJSONDataMessage converts msg into an MqttMessage and pushes it to the outbox channel
@param msg - pointer to the JsonDataMessage to parse and send to the broker
func PublishJSONString ¶
func PublishJSONString(json []byte)
PublishJSONString converts msg into an MqttMessage and pushes it to the outbox channel
@param json - byte slice to parse and send to the broker
func PublishMQTTMessage ¶
func PublishMQTTMessage(msg *proto.MqttMessage) (err error)
PublishMQTTMessage pushes msg to the outbox channel for processing
@param msg - pointer to the MqttMessage to send to the broker
func PublishOPCMessage ¶
func PublishOPCMessage(msg *proto.OpcMessage) error
PublishOPCMessage converts msg into an MqttMessage and pushes it to the outbox channel
@param msg - pointer to the OpcMessage to parse and send to the broker
func Update ¶
func Update(mqttConfig *proto.MqttConfig) error
Update does the following: - converts the given mqttConfig into a paho mqtt client options struct - closes the current client connection - starts a new client connection with the new client options
@param mqttConfig - MqttConfig proto struct containing mqtt client configs
Types ¶
This section is empty.