@@ -38,31 +38,36 @@ type serverGRPC struct {
3838 TLSPublicKey string
3939}
4040
41+ // serverMQTT represents the complete configuration for an MQTT server setup.
42+ // It includes authentication, Consul configuration, and consumer-specific settings.
4143type serverMQTT struct {
42- ConsulConfig consul
43- AuthConfig auth
44- ConsumerConfig consumer
45- ConnGroup string
44+ ConsulConfig consul // Configuration related to Consul service discovery
45+ AuthConfig auth // MQTT authentication credentials
46+ ConsumerConfig consumer // Consumer behavior and connection settings
47+ ConnGroup string // Connection group name used for identifying MQTT client group
4648}
4749
50+ // auth defines MQTT authentication credentials.
4851type auth struct {
49- Username string
50- Password string
52+ Username string // Username for authenticating with the MQTT broker
53+ Password string // Password for authenticating with the MQTT broker
5154}
5255
56+ // consul holds configuration details for connecting and interacting with a Consul agent.
5357type consul struct {
54- Address string
55- HealthOnly bool
56- KVKey string
57- WaitTime time.Duration
58+ Address string // Address of the Consul agent (e.g., localhost:8500)
59+ HealthOnly bool // When true, only healthy service instances are used
60+ KVKey string // Key in Consul KV store for retrieving configuration or metadata
61+ WaitTime time.Duration // Maximum wait time for Consul blocking queries
5862}
5963
64+ // consumer contains configuration parameters controlling MQTT message consumption.
6065type consumer struct {
61- RetryIntervalInSec time.Duration
62- LogLevel string
63- WriteTimeoutInSec time.Duration
64- PoolSize int
65- TopicFormat string
66+ RetryIntervalInSec time.Duration // Time interval (in seconds) before retrying connection or message processing
67+ LogLevel string // Log verbosity level (e.g., "info", "debug", "error")
68+ WriteTimeoutInSec time.Duration // Timeout duration (in seconds) for write operations
69+ PoolSize int // Number of concurrent consumer workers or goroutines
70+ TopicFormat string // Format or pattern for subscribing to MQTT topics (e.g., "topic/{region}/{service}")
6671}
6772
6873func serverConfigLoader () {
@@ -142,7 +147,7 @@ func serverMQTTConfigLoader() {
142147 ConsumerConfig : consumer {
143148 RetryIntervalInSec : util .MustGetDuration ("SERVER_MQTT_CONSUMER_RETRY_INTERVAL_IN_SEC" , time .Second ),
144149 LogLevel : util .MustGetString ("SERVER_MQTT_CONSUMER_LOG_LEVEL" ),
145- WriteTimeoutInSec : util .MustGetDuration ("SERVER_MQTT_CONSUMER_POOL_SIZE " , time .Second ),
150+ WriteTimeoutInSec : util .MustGetDuration ("SERVER_MQTT_CONSUMER_WRITE_TIMEOUT_IN_SEC " , time .Second ),
146151 PoolSize : util .MustGetInt ("SERVER_MQTT_CONSUMER_POOL_SIZE" ),
147152 TopicFormat : util .MustGetString ("SERVER_MQTT_CONSUMER_TOPIC_FORMAT" ),
148153 },
0 commit comments