I want to log all mqtt messages of the broker. How should I design schema of database. Avoiding dulplicate entries and fast searching -


i implementing callback in java store messages in database. have client subscribing '#'. problem when # client disconnects , reconnect adds duplicate entries in database of retained messages. if search previous entries bigger tables expensive in computing power. should allot separate table each sensor or per broker. appreciate if suggest me better designs.

subscribing wildcard single client anti-pattern. reasons are:

  1. wildcard subscribers all messages of mqtt broker. client libraries can't handle load, not when transforming / persisting messages.
  2. if wildcard subscriber dies, will lose messages (unless broker queues endlessly you, doesn't work)
  3. you have single point of failure in system. use mqtt brokers hardened production use. these more robust single point of failures hand-written clients. (you can overcome sip through clustering , load balancing, though).

so solve problem, suggest following:

  • use broker can handle shared subscriptions (like hivemq or messagesight), can balance messages between many clients
  • use custom plugin doing persistence @ broker instead of client.

you can read more topic here: http://www.hivemq.com/blog/mqtt-sql-database


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -