Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMessageHandler ¶
func NewMessageHandler(metric config.Metric, collector prometheus.Collector) pahomqtt.MessageHandler
NewMessageHandler constructs handler for single metric.
Types ¶
type Listener ¶
type Listener interface { Subscribe(topic string, mh pahomqtt.MessageHandler) error Close() Check(ctx context.Context) error }
Listener provides actions over MQTT client.
func NewListener ¶
func NewListener(lo ...ListenerOption) (Listener, error)
NewListener creates listener over MQTT client.
type ListenerOption ¶
type ListenerOption func(options *pahomqtt.ClientOptions)
ListenerOption allows to configure MQTT client.
func WithHostAndPort ¶
func WithHostAndPort(host string, port int) ListenerOption
WithHostAndPort is option that defines MQTT broker.
func WithPassword ¶
func WithPassword(password string) ListenerOption
WithPassword is option that sets connection credentials.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ListenerOption
WithTimeout is option that sets MQTT client timeout.
func WithUsername ¶
func WithUsername(username string) ListenerOption
WithUsername is option that sets connection credentials.
Click to show internal directories.
Click to hide internal directories.