mqtt

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source implements hermod.Source for MQTT brokers using Eclipse Paho. It supports: - Multiple topic subscriptions (comma-separated filters) - QoS 0/1/2 - TLS with system roots and optional InsecureSkipVerify - Auto reconnect with configurable max interval - Graceful shutdown

func NewSource

func NewSource(cfg map[string]string) (*Source, error)

NewSource constructs a new MQTT source. Expected config keys: - broker_url: e.g. tcp://localhost:1883, ssl://broker:8883, ws://..., wss://... - topics: comma-separated list of topic filters - client_id: optional client identifier - username, password: optional auth - qos: 0|1|2 - clean_session: true|false (default true) - keepalive: duration in seconds (default 30) - tls_insecure_skip_verify: true|false (default false) - max_reconnect_interval: duration (e.g., 30s)

func (*Source) Ack

func (s *Source) Ack(ctx context.Context, msg hermod.Message) error

Ack is a no-op for MQTT; QoS is handled by the client library.

func (*Source) Close

func (s *Source) Close() error

func (*Source) Ping

func (s *Source) Ping(ctx context.Context) error

func (*Source) Read

func (s *Source) Read(ctx context.Context) (hermod.Message, error)

Read blocks until a message arrives or context is done. Returns (nil, nil) on context timeout/cancel.

func (*Source) Sample

func (s *Source) Sample(ctx context.Context, table string) (hermod.Message, error)

Sample connects to the broker, subscribes to the configured topics, and waits for a single message so the UI can preview the payload and surface its keys as available fields for downstream transformation/sink nodes. It uses a dedicated connection with a clean session and a fresh client ID, so it never disturbs the running ingestion consumer; MQTT delivers by broadcast, so sampling is non-destructive and does not consume or skip real data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL