Difference between revisions of "Mqtt"

From AMTech WikiDocs
Jump to: navigation, search
Line 13: Line 13:
  
  
''' Client applications required config '''
+
''' Client applications config '''
  
 
Client applications that want to send messages, and receive them all (including messages that were sent to topics when the client app was offline), must :
 
Client applications that want to send messages, and receive them all (including messages that were sent to topics when the client app was offline), must :

Revision as of 09:52, 13 October 2020

Topic Structure

  • User-defined topics in the form of tenant/obsType/custom/topic/parts
  • Tenant and observation type explicitly required in all topic
  • Topics created as activityCreator are only for configuration purposes and are saved in DB
    • They are used in reasoners configuration inside activity
    • They do not include tenant in their name (creator topics in the form of /amtech/things/eventsources/<topic>/<levels>)
  • Topics created as follower or as part of the execution of an activity are not persistd in DB. They are mqtt topics to hold observations
  • System topics in the form of prefix/tenant (ex. topic for OTA, for new digital twin, etc.)
  • Core topics
    • Commands : _cmd/<tenant>/<thingtype>/<thingid>/<user-defined>/<path>
    • Crud : <tenant>/observationresourcecrud/<thingType>/<thingId>/<crudOp>
    • Bridge crud: _bridge/<tenant>/observationresourcecrud/amtechM2mBridge/<bridgeId>/_all/<propId>


Client applications config

Client applications that want to send messages, and receive them all (including messages that were sent to topics when the client app was offline), must :

  • Use the same client ID every time it reconnects, or use a MQTT client with the option automatic-reconnect set to true
  • Connect with clean_session=False
  • Subscribe to topics QoS>0
  • Publish messages with QoS>0

For more info go to : https://vernemq.com/intro/mqtt-and-vernemq-for-developers/connecting_to_mqtt_and_vernemq.html