Working with Microsoft Azure IoT Hub processors
Data Integration Platform supports Microsoft Azure IoT Hub data source using GetAzureTOTHub and PutAzureIOTHub processors.
Fetch data from Azure IoT Hub
GetAzureIOTHub Processor in Data Integration Platform is used to fetch data from Microsoft Azure IoT Hub. The overview of the template is given below which is used to get the data from Azure IoT Hub and store it in File and it can be visualized in the Syncfusion Dashboard.
The following are the list of processors used in this sample,
Fetches the Data from Azure IoT Hub.
Updates the File Name.
Stores the Data Retrieved into File.
Publish the Data into Dashboard.
Get endpoints, partitions, shared access primary keys, and hub name details by using the following steps before configuring and running the sample.
Get endpoints from Azure Portal
Step 1: Logon to Azure portal https://portal.azure.com/
Step 2: Choose your respected Azure IOT Hub in dashboard page.
Step 3: Type “endpoints” in search box and select the Events from built-in endpoints. It shows the value of partitions, Hub-compatible names and endpoints. For IOT Hub Endpoint get only the Namespace from the Event Hub-compatible endpoint.
For example, if your Event Hub-compatible endpoint is sb://iothub-ns-myiothub-1234.servicebus.windows.net/, the Hostname would be iothub-ns-myiothub-1234.servicebus.windows.net. The Namespace would be iothub-ns-myiothub-1234.
Get Shared Access Primary Key
Step 1: Type “shared access policies” in search box, choose Shared access policies and select the iothubowner from Policy. Copy the primary key from Shared access keys.
Steps to configure and run the Sample
Step 1 - Configure “Get Data from Sales Azure IOT Hub” processor
- To configure, double click the processor or right click and select configure.
- To get data from Azure IOT Hub, follow the steps given above and update those properties.
- Enter the starting date from when the data should be retrieved in Enqueue Date property.
Step 2 - Configure “Update File Name” processor
- Double click the processor and add new property named filename and add value as the file name in which flow file should be written.
Step 3 - Configure “Store Data Retrieved into File” processor
- Double click the processor and set output directory in “Directory” property to where the file should be created.
Step 4 - Add Publish Data into Dashboard processor
- Add PublishDataSource processor to view the data in Syncfusion dashboard. Flat file location will be retrieved and set automatically from the upstream processor (PutFile in this workflow).
Step 5 – Visualization in Syncfusion Dashboard
- Refer to the Import data source to designer and import the data source from Data Integration Platform into designer and useful view in the designer can be created to evaluate the data.
Push data into Azure IoT Hub
You can also push data into Azure IoT Hub using PutAzureIOTHub processor from Data Integration Platform.
Get value of Device Id and Device Primary Key
Enter “IoT Devices” in search box, select your device from the DEVICE ID.
You can get Device Id and Primary key from Device Details.
Configure PutAzureIOTHub processor
Drag and drop the processor into canvas. Double click the processor and set IoT Hub name, device id, and device primary key. Once it is configured, you can push flow file data into Azure IoT using PutAzureIOTHub processor.