MqttTopicSampler
class MqttTopicSampler(clientFactory: (ModuleConfig.MQTTConfig?) -> TopicSamplerClient = ::defaultSamplerClient, duration: Duration = DEFAULT_DURATION, connectDeadline: Duration = 15.seconds, subscribeDeadline: Duration = 10.seconds, timeSource: TimeSource = TimeSource.Monotonic)(source)
A subscribe-only broker connection that listens for a fixed time and tallies the roots it hears. Every topic it sees is location-derived, so nothing here logs a topic, root or count tied to one.
Constructors
Link copied to clipboard
constructor(clientFactory: (ModuleConfig.MQTTConfig?) -> TopicSamplerClient = ::defaultSamplerClient, duration: Duration = DEFAULT_DURATION, connectDeadline: Duration = 15.seconds, subscribeDeadline: Duration = 10.seconds, timeSource: TimeSource = TimeSource.Monotonic)
Types
Link copied to clipboard
Link copied to clipboard
data class State(val phase: MqttTopicSampler.Phase = Phase.Idle, val activity: Map<String, MqttTopicDiscovery.Activity> = emptyMap(), val messageCount: Int = 0)
Functions
Link copied to clipboard
Runs one sample to completion. Cancelling the caller ends it early and keeps what was heard, as does the broker closing the connection once something has arrived. Any other error fails it with Failure.ERROR.