Documentation
¶
Overview ¶
Package mqttin contains the mqttIn node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MQTTInConfig ¶
type MQTTInConfig struct {
// Broker is host:port or a full URL (tcp://host:port).
Broker string `json:"broker"`
// Topic is the subscription topic; MQTT wildcards + and # work.
Topic string `json:"topic"`
// QoS is the subscription quality of service (0|1|2).
QoS int `json:"qos"`
// Datatype selects payload decoding: "auto" (JSON parse, else
// string), "utf8" (string), "json" (parse or error), "base64".
Datatype string `json:"datatype"`
// subscription: the filter becomes $share/<group>/<topic> and the
// broker load-balances deliveries across all subscribers in the
// group (active-active triggers for multi-runner deployments).
// A raw $share/<group>/<topic> value in Topic also works and is
// passed through unchanged.
ShareGroup string `json:"shareGroup"`
// Username/Password are optional broker credentials. They are
// credential-typed fields: stored outside the exported flow
// document and merged back in at deploy time.
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
MQTTInConfig holds configuration for the mqttIn node. Broker settings are inline per node — the Node-RED shared broker config-node concept is deferred (see docs/ai/tasks 30-mqtt-nodes).
type MQTTInNode ¶
MQTTInNode subscribes to an MQTT broker topic on deploy and emits every received message downstream. It is a Stopper: the client lives on the node instance itself (activation runs Execute once and the same instance is kept for Stop).
func NewMQTTInNode ¶
func NewMQTTInNode(node nodestore.NodeInterface, config *MQTTInConfig, host nodebase.NodeHost) *MQTTInNode
NewMQTTInNode creates a new mqttIn node
func (*MQTTInNode) Execute ¶
func (n *MQTTInNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute connects to the broker and subscribes. The connect happens synchronously so an unreachable broker surfaces as a deploy error.
func (*MQTTInNode) Validate ¶
func (n *MQTTInNode) Validate() error
Validate checks the mqttIn node configuration