Write Device Drivers

Introduction

There are four AMQP access points that a third party service (device driver or support service) uses to communicate with the core Edge Compute Platform services:
ase.exchange.api
Exchange to publish API request, the third party service needs to create a callback queue to subscribe to for the response.
ase.exchange.telemetry
Exchange to publish telemetry data.
ase.exchange.driver
Exchange to bind a custom queue to and subscribe to process incoming messages (like commands).
ase.exchange.core
Exchange to publish specific messages to core services (like sending up a discovery report).

See the AMQP Users section for details on the users that have been configured for this communication.

See the Inter-service Messaging section for details on these exchanges.

A (pseudo code) example of the device driver (work-)flow is described in a subsequent section.

Exchange API: Make API Calls

See Exchange ase.exchange.api for details on the AMQP user to use, the messages sent/received and how a callback queue can be created.

An RPC pattern, "RabbitMQ RPC Tutorial", is recommended to mimic a blocking REST API call.

See the Use API section.

Exchange Telemetry: Publish Data

See Exchange ase.exchange.telemetry for details on the AMQP user to use and the messages sent.

Various types of messages can be published to this exchange, in line with Web-of-Things messages; propertyStatus, actionStatus, and event.

See the Send or Process Telemetry Data section.

Exchange Driver: Queue Binding

See Exchange ase.exchange.driver for details on the AMQP user to use, the messages sent/received and how a callback queue can be created.

A driver service only needs one (1) ase.queue.driver.* queue which can then be bound to the ase.exchange.driver with various header bindings.

An approach like the following is suggested:

Always bind with:

Exchange Bind Match Bind Headers Notes
ase.exchange.driver x-match=all messageType=addThing When a new Thing is added to the system the driver can process it if it supports the type.

For each Thing bind with:

exchange bind match bind headers notes
ase.exchange.driver x-match=all thingID={thingID} This will only be done for Things the driver supports. Will catch Thing updates (messageType=updateThing) and deletes (messageType=deleteThing). More importantly this will process Thing specific messages, such as messageType=setProperty, messageType=requestAction etc.

The individual Thing bindings should be added and removed when Things are added to or removed from Edge Compute Platform core services. In other words, dynamic binding.

Exchange Core: Specific Publishing to Core

See Exchange ase.exchange.core for details on the AMQP user to use and the messages sent.

This is used for publishing specific messages to Core Services, such as publishing generated discovery reports.