advanced.rst 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. .. _advanced:
  2. ========
  3. Advanced
  4. ========
  5. *EMQ* 2.0-rc.2 release supports `Local Subscription` and `Shared Subscription`.
  6. ------------------
  7. Local Subscription
  8. ------------------
  9. The *EMQ* broker will not create global routes for `Local Subscription`, and only dispatch MQTT messages on local node.
  10. .. code-block:: shell
  11. mosquitto_sub -t '$local/topic'
  12. mosquitto_pub -t 'topic'
  13. Usage: subscribe a topic with `$local/` prefix.
  14. -------------------
  15. Shared Subscription
  16. -------------------
  17. Shared Subscription supports Load balancing to distribute MQTT messages between multiple subscribers in the same group::
  18. ---------
  19. | | --Msg1--> Subscriber1
  20. Publisher--Msg1,Msg2,Msg3-->| EMQ | --Msg2--> Subscriber2
  21. | | --Msg3--> Subscriber3
  22. ---------
  23. Two ways to create a shared subscription:
  24. +-----------------+-------------------------------------------+
  25. | Prefix | Examples |
  26. +-----------------+-------------------------------------------+
  27. | $queue/ | mosquitto_sub -t '$queue/topic |
  28. +-----------------+-------------------------------------------+
  29. | $share/<group>/ | mosquitto_sub -t '$share/group/topic |
  30. +-----------------+-------------------------------------------+