consume

package
v0.0.0-...-d6fb9c7 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandlerClimate

func NewHandlerClimate(_ context.Context, logger *zap.Logger) mqtt.MessageHandler

func NewHandlerSystem

func NewHandlerSystem(_ context.Context, logger *zap.Logger) mqtt.MessageHandler

func NewMQTTClient

func NewMQTTClient(cfg MQTTConfig, logger *zap.Logger) (mqtt.Client, error)

func StartConsumer

func StartConsumer(mqttClient mqtt.Client, topic string, messageHandler mqtt.MessageHandler) error

Types

type Config

type Config struct {
	MQTTConfig
	core.LoggerConfig
}

type MQTTConfig

type MQTTConfig struct {
	Server       string `envconfig:"MQTT_HOST" default:"tcp://127.0.0.1:1883"`
	ClientID     string `envconfig:"MQTT_CLIENT_ID" default:"meteo-collector"`
	TopicSensors string `envconfig:"MQTT_TOPIC_SENSORS" default:"climate/#"`
	TopicSystem  string `envconfig:"MQTT_TOPIC_SYSTEM" default:"sys/#"`

	ConnectTimeout    time.Duration `envconfig:"MQTT_CONNECT_TIMEOUT" default:"3s"`
	DisconnectTimeout time.Duration `envconfig:"MQTT_DISCONNECT_TIMEOUT" default:"3s"`
}

Jump to

Keyboard shortcuts

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