You can use the Azure Service Bus Connector to receive data from devices connected through the Azure IoT Platform.
Note that, the Service Bus Connector supports only the Queue mode.
For more details about Azure Service Bus configuration, refer to this guide.
Plugin Configuration
To enable this plugin, you need to:- Go to the Integrations / Plugins page.
- Select the IoT Connectors category.
- Locate the Azure Service Bus card.
- Click on the card switch to activate the plugin.
Connector Mapping Configuration
Once the plugin has been enabled, within the DPS, for each business entity level (tenant, customer, location, or thing), it is possible to configure the Azure Service Bus Connector.
The connector mapping requires providing:
- Account Name: the name of the Azure Service Bus account.
- Account Key: the access key configured within the Azure administration console.
- Namespace: the namespace the queue is published to.
- Queue: the name of the queue.
For each unique connection mapping, a connection is opened to the Azure Service Bus by using a Connection String so defined:
Endpoint=sb://[NAMESPACE].servicebus.windows.net/;SharedAccessKeyName=[ACCOUNT_NAME];SharedAccessKey=[ACCOUNT_KEY]
Once connected, a subscription is established to the queue, and only the messages targeting a known path will be processed by the connector.
The path of an Azure Service Bus message must be in the following form
<ASSET_ID>/<PATH>/<METRIC_PATH>
Where ASSET_ID and PATH (optional) are specified on the thing mapping, and the METRIC_PATH is specified within the metric mapping (e.g. SN12345/IC2/measures).
The path can be set as the "to" attribute, directly on the Azure Service Bus message, or as the "path" property within the message JSON payload. The path is mandatory to allow the connector to identify the target thing of the message extracted from the queue.
Messages must be published on the Azure Service Bus by using a JSON payload having the following format:
{ "path": "SN12345/IC2/measures", "ts": 1605179226000, "data": { "metric1": 1234, "metric2": "foobar", "metric3": true } }
The timestamp (ts) in milliseconds is optional, and if omitted the server-side reception time is used instead. Field names within the data node must be the same used in the metric mapping.
Parameters and Command Management
Messages addressed from cloud to a thing (e.g. commands, configuration-parameters, firmware updates) are addressed to a specific path:
- Configuration Parameter must be mapped on the "/update" path (e.g. SN12345/IC2/update)
- Commands must be mapped on the "/command" path (e.g. SN12345/IC2/command)
- Firmware updates are published to "/update" by default.
For this reason, commands and parameters must be mapped on the update or command path, respectively. The path is set as the "to" attribute and the "path" property within the message payload.
Comments
0 comments
Please sign in to leave a comment.