You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/hdinsight-aks/flink/azure-iot-hub.md
+172-1Lines changed: 172 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ ms.date: 04/04/2024
10
10
11
11
Azure IoT Hub is a managed service hosted in the cloud that acts as a central message hub for communication between an IoT application and its attached devices. You can connect millions of devices and their backend solutions reliably and securely. Almost any device can be connected to an IoT hub.
12
12
13
+
In this example, the code processes real-time IoT data on Apache Flink® with Azure HDInsight on AKS and sinks to ADLS gen2 storage.
14
+
13
15
## Prerequisites
14
16
15
17
*[Create an Azure IoTHub](/azure/iot-hub/iot-hub-create-through-portal/)
@@ -20,14 +22,183 @@ Azure IoT Hub is a managed service hosted in the cloud that acts as a central me
20
22
> [!NOTE]
21
23
> For this demonstration, we are using a Window VM as maven project develop env in the same VNET as HDInsight on AKS.
22
24
25
+
## Flink cluster 1.17.0 on HDInsight on AKS
23
26
24
27
:::image type="content" source="./media/azure-iot-hub/configuration-management.png" alt-text="Diagram showing search bar in Azure portal." lightbox="./media/azure-iot-hub/configuration-management.png":::
25
28
29
+
## Azure IOT Hub on Azure portal
30
+
31
+
Within the connection string, you can find a service bus URL (URL of the underlying event hub namespace), which you need to add as a bootstrap server in your Kafka source. In this example, it's `iothub-ns-contosoiot-55642726-4642a54853.servicebus.windows.net:9093`.
Each IoT hub comes with built-in system endpoints to handle system and device messages.
38
+
39
+
For more information, see [How to use VS Code as IoT Hub Device Simulator](https://devblogs.microsoft.com/iotdev/use-vs-code-as-iot-hub-device-simulator-say-hello-to-azure-iot-hub-in-5-minutes/).
IoTHub is build on top of event hub and hence supports a kafka-like API. So in our Flink job, we can define a KafkaSource with appropriate parameters to consume messages from IoTHub.
## Package the jar and submit the job in Flink cluster
185
+
186
+
Upload the jar into webssh pod and submit the jar.
187
+
188
+
```
189
+
user@sshnode-0 [ ~ ]$ bin/flink run -c IOTdemo -j FlinkIOTDemo-1.0-SNAPSHOT.jar
190
+
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
191
+
SLF4J: Defaulting to no-operation (NOP) logger implementation
192
+
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
193
+
Job has been submitted with JobID de1931b1c1179e7530510b07b7ced858
194
+
```
195
+
## Check job on Flink Dashboard UI
196
+
197
+
:::image type="content" source="./media/azure-iot-hub/flink-ui-dashboard.png" alt-text="Screenshot showing the Flink UI dashboard." lightbox="./media/azure-iot-hub/flink-ui-dashboard.png":::
198
+
199
+
## Check Result on ADLS gen2 on Azure portal
29
200
30
-
:::image type="content" source="./media/azure-iot-hub/create-new-job.png" alt-text="Screenshot shows create a new job." lightbox="./media/azure-iot-hub/create-new-job.png":::
201
+
:::image type="content" source="./media/azure-iot-hub/check-results.png" alt-text="Screenshot showing the results." lightbox="./media/azure-iot-hub/check-results.png":::
0 commit comments