3

I currently have a Mosquitto MQTT Broker on which some IoT Nodes publish their information on a specific topic. I have an instance of Telegraf from InfluxData running that subscribes to this topic and stores the information into InfluxDB.

Requirements:

I understand that the information once published on a topic will be sent out immediately to the subscriber from the Broker. I am looking for a retention or caching mechanism in MQTT Broker which can wait till there are X number of datapoints on the topic that are published and then sent to the Subscriber.

Is there such a mechanism that exists in standard MQTT Brokers or does this go beyond the MQTT Standard?

4

No, this is not possible with a MQTT broker.

There are 2 situations where a broker will cache a message on a given topic.

  1. When a message is published with the retained bit set. This message will be stored and delivered to any client that subscribed to a matching topic before any new messages. This is a single message per topic and a new message with the retained bit will replace any current message.

  2. If a client has a persistent subscription and is offline, the broker will queue all messages sent while it is offline to deliver when it reconnects (unless it sets the cleanSession bit to true in it's connection packet)

The only way to achieve what you describe is to have another client batch up the messages and publish the collection on a different topic

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.