Documentation
¶
Overview ¶
Package mqtt implements the MQTT transport for CoreC.
Index ¶
- Constants
- func NewMQTTTransport(config core.TransportConfig) (core.Transport, error)
- type MQTTTransport
- func (t *MQTTTransport) CommandDeadLetterEntries() []core.DeadLetterEntry
- func (t *MQTTTransport) ForwardCommand(ctx context.Context, cmd core.WriteCommand) error
- func (t *MQTTTransport) Init(ctx context.Context, config core.TransportConfig) error
- func (t *MQTTTransport) Name() string
- func (t *MQTTTransport) OnCommand() <-chan core.WriteCommand
- func (t *MQTTTransport) OnData() <-chan core.DataPoint
- func (t *MQTTTransport) Publish(ctx context.Context, point core.DataPoint) error
- func (t *MQTTTransport) PublishBatch(ctx context.Context, points []core.DataPoint) error
- func (t *MQTTTransport) Start(ctx context.Context) (err error)
- func (t *MQTTTransport) Status() core.TransportStatus
- func (t *MQTTTransport) Stop() error
- func (t *MQTTTransport) Type() string
Constants ¶
const TypeName = "mqtt"
TypeName identifies this transport's protocol. It is returned by Type() and embedded in Status() so the transport kind is reported consistently from a single source of truth rather than a scattered string literal.
Variables ¶
This section is empty.
Functions ¶
func NewMQTTTransport ¶
func NewMQTTTransport(config core.TransportConfig) (core.Transport, error)
NewMQTTTransport creates a new MQTT transport from configuration.
Types ¶
type MQTTTransport ¶
type MQTTTransport struct {
// contains filtered or unexported fields
}
MQTTTransport implements core.Transport for MQTT protocol.
func (*MQTTTransport) CommandDeadLetterEntries ¶ added in v0.0.3
func (t *MQTTTransport) CommandDeadLetterEntries() []core.DeadLetterEntry
CommandDeadLetterEntries returns a copy of the transport-local dead-letter entries for commands dropped at ingress (command channel full). It is intended for operator inspection / replay tooling and is not part of the core.Transport interface (callers type-assert to *MQTTTransport).
func (*MQTTTransport) ForwardCommand ¶ added in v0.0.3
func (t *MQTTTransport) ForwardCommand(ctx context.Context, cmd core.WriteCommand) error
ForwardCommand publishes a write command to the command-forward-topic, enabling chained-core command passthrough. Relay nodes that have no local driver for the command target use this to forward commands to downstream nodes.
When command-forward-secret is configured, the forwarded command is signed with HMAC-SHA256 and includes a fresh timestamp so the downstream node can authenticate it and enforce replay protection. When no secret is configured, the command is forwarded unsigned (backward compatible with unauthenticated command setups).
func (*MQTTTransport) Init ¶
func (t *MQTTTransport) Init(ctx context.Context, config core.TransportConfig) error
func (*MQTTTransport) Name ¶
func (t *MQTTTransport) Name() string
func (*MQTTTransport) OnCommand ¶
func (t *MQTTTransport) OnCommand() <-chan core.WriteCommand
func (*MQTTTransport) OnData ¶
func (t *MQTTTransport) OnData() <-chan core.DataPoint
OnData returns the channel of data points received from the subscribed data topic. Returns a non-nil channel only when data-topic is configured.
func (*MQTTTransport) PublishBatch ¶
func (*MQTTTransport) Status ¶
func (t *MQTTTransport) Status() core.TransportStatus
func (*MQTTTransport) Stop ¶
func (t *MQTTTransport) Stop() error
func (*MQTTTransport) Type ¶
func (t *MQTTTransport) Type() string