HiveMQ's blog lists under "best practices" not to subscribe to the multi level wildcard when attempting to dump all messages to a database. They claim that the subscribing client may not be able to keep up with a high load of messages and propose to use a broker plugin to directly hook into the stream of messages instead.
Sometimes it is necessary to subscribe to all messages, which are transferred over the broker, for example when persisting all of them into a database. This should not be done by using a MQTT client and subscribing to the multi level wildcard. The reason is that often the subscribing client is not able to process the load of messages that is coming its way. Especially if you have a massive throughput. Our recommended solution is to implement an extension in the MQTT broker, for example the plugin system of HiveMQ allows you to hook into the behavior of HiveMQ and add a asynchronous routine to process each incoming message and persist it to a database.
Is there either
- a similar system (extension/plugin) for the mosquitto broker,
- another recommended method that works with mosquitto, or
- reasonable evidence that this approach is unnecessary at all, i.e. that a client subscribing to
#can do just fine?
https://stackoverflow.com/q/31584613/3984613 does not address this question exhaustively.