In this post, I asked if it was possible to keep a message in a queue in ActiveMQ Artemis until all subscribers had received it, and the answer was that this can be done using the clean = false flag.
I haven't tested this yet due to corporate firewall restrictions, but I think the MQTT "clean" parameter may be handled in the Telegraf MQTT listener by the "persistent_session = true" parameter - there is no "clean" parameter available.
But I do wonder how MQTT distinguishes between when a particular subscriber is offline vs. when the subscriber process has simply been terminated? If you terminate the Telegraf process, it wouldn't be able to send the unsubscribe command, so the message would be kept permanently or until some message expiration limit has been met (that might be ok, actually).
So basically the question is, how do you specify the "clean" parameter in the Telegraf MQTT listener?
Different MQTT client implementations will represent protocol semantics in different ways. In this case it appears the Telegraf Input Plugin for MQTT represents the
CleanSession
flag for theCONNECT
control packet aspersistent_session
.The documentation says this about
persistent_session
:So setting
persistent_session
totrue
would seem to be equivalent to setting theCleanSession
flag tofalse
.