Advanced MQTT and Kura - EclipseCON 2014

2,616 views

Published on

Best Practices for Topic Namespaces in M2M Applications
EclipseCON 2014, San Francisco

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,616
On SlideShare
0
From Embeds
0
Number of Embeds
27
Actions
Shares
0
Downloads
89
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Advanced MQTT and Kura - EclipseCON 2014

  1. 1. Advanced MQTT and Kura Best Practices for Topic Namespaces in M2M Applications EclipseCon 2014, March 19th
  2. 2. IOT MQTT System Topology Sensors Actuators Legacy Systems Smart Machines M2M Multi Services Gateway Human / Machine Interfaces Meters Console/Port al APIs Business Logic
  3. 3. Request and Response in MQTT Use cases • Device Firmware/Software Updates – Did the device get the update? When? Was it valid & installed? • Configuration Updates – Same Questions… • Remote Resource Control/Interaction – Device management/Backend business logic needs to start/stop/interact with a device side service • Control of actuators • Dynamic status requests • Remote Command execution • Remote Service Control/Interaction • Other considerations – Extensibility, mutitenancy, client addressing, multiple applications, resource management…
  4. 4. MQTT Topic Space Considerations • Data Topics – Used for push of sensor data, metrics, or other data – Example: [account_id]/[client_id]/... • Control Topics – Used for dynamic request/response interactions between clients – Example: CTL/[account_id]/[client_id]/[app_id]/… • Separate data from control topics – Provides increased granularity on ACLs – Allows for segregation of persistent and transient data
  5. 5. MQTT Request Verbs • Request – CTL/[account_id]/[client_id]/[app_id]/GET/[resource_id] – CTL/[account_id]/[client_id]/[app_id]/POST/[resource_id] – CTL/[account_id]/[client_id]/[app_id]/PUT/[resource_id] – CTL/[account_id]/[client_id]/[app_id]/DEL/[resource_id] – CTL/[account_id]/[client_id]/[app_id]/EXEC/[resource_id] • Response – CTL/[account_id]/[requester_client_id]/[app_id]/REPLY/[req_id] REST Like
  6. 6. Request/Response Example Flow Responder (device1) Requester (manager1) Responder Subscribes on request topic: CTL/kura/device1/CONF-V1/GET/configurations Requester Generates request metadata (for request payload): request_id: 1363603920892 request_client_id: manager1 Subscribes on reply topic: CTL/kura/manager1/CONF-V1/REPLY/1363603920892 Requester Sends MQTT request CTL/kura/device1/CONF-V1/GET/configurations Responder Handles request and generates response using request specific parameters in the payload of the request • [request_id] and [request_client_id] included in request payload • Manditory response code • Optional application specific parameters • Optional logs, exceptions, stacktraces, etc Responder Sends response to requesting client CTL/kura/manager1/CONF-V1/REPLY/1363603920892
  7. 7. Response Codes • response_code – 200 (RESPONSE_CODE_OK) – 400 (RESPONSE_CODE_BAD_REQUEST) – 404 (RESPONSE_CODE_NOTFOUND) – 500 (RESPONSE_CODE_ERROR) • response_exception_message – Optional and contains error message if an error occurred • response_stacktrace_message – Optional and contains a stacktrace HTTP Like
  8. 8. Kura Cloudlet • Uses Kura Cloud Client – Allows for one MQTT connection across many applications – Built in configurable store/forward of messages on device – Handles callback routing to applications based on [app_id] • Offers simple overrides for request/response operations
  9. 9. Kura Cloudlet
  10. 10. Thank You

×