|
| 1 | +--- |
| 2 | +title: Use jobs to schedule tasks for groups of devices |
| 3 | +titleSuffix: Azure IoT Hub |
| 4 | +description: How to use the service SDK to schedule a job that invokes a device direct method and updates desired device twin properties. |
| 5 | +author: kgremban |
| 6 | +ms.author: kgremban |
| 7 | +manager: lizross |
| 8 | +ms.service: azure-iot-hub |
| 9 | +ms.devlang: csharp |
| 10 | +ms.topic: how-to |
| 11 | +ms.date: 1/15/2025 |
| 12 | +zone_pivot_groups: iot-hub-howto-c2d-1 |
| 13 | +--- |
| 14 | + |
| 15 | +# How to schedule and broadcast jobs |
| 16 | + |
| 17 | +This article shows you how to create back-end app code to schedule and broadcast jobs. |
| 18 | + |
| 19 | +Use Azure IoT Hub to schedule and track jobs that update up to millions of devices for these operations: |
| 20 | + |
| 21 | +* Invoke direct methods |
| 22 | +* Updated device twins |
| 23 | + |
| 24 | +A job wraps one of these actions and tracks the execution against a set of devices that is defined by a device twin query. For example, a back-end app can use a job to invoke a direct method on 10,000 devices that reboots the devices. You specify the set of devices with a device twin query and schedule the job to run at a future time. The job monitors progress as each of the devices receives and executes the reboot direct method. |
| 25 | + |
| 26 | +To learn more about each of these capabilities, see: |
| 27 | + |
| 28 | +* Device twin and properties: [Get started with device twins](device-twins-dotnet.md) and [Understand and use device twins in IoT Hub](iot-hub-devguide-device-twins.md) |
| 29 | +* Direct methods: [IoT Hub developer guide - direct methods](iot-hub-devguide-direct-methods.md) |
| 30 | + |
| 31 | +[!INCLUDE [iot-hub-basic](../../includes/iot-hub-basic-whole.md)] |
| 32 | + |
| 33 | +> [!NOTE] |
| 34 | +> This article is meant to complement [Azure IoT SDKs](iot-hub-devguide-sdks.md) samples that are referenced from within this article. You can use SDK tools to build both device and back-end applications. |
| 35 | +
|
| 36 | +## Prerequisites |
| 37 | + |
| 38 | +* An IoT hub |
| 39 | + |
| 40 | +* A registered device |
| 41 | + |
| 42 | +* If your application uses the MQTT protocol, make sure that port 8883 is open in your firewall. The MQTT protocol communicates over port 8883. This port may be blocked in some corporate and educational network environments. For more information and ways to work around this issue, see [Connecting to IoT Hub (MQTT)](../iot/iot-mqtt-connect-to-iot-hub.md#connecting-to-iot-hub). |
| 43 | + |
| 44 | +:::zone pivot="programming-language-csharp" |
| 45 | + |
| 46 | +[!INCLUDE [iot-hub-howto-schedule-broadcast-jobs-dotnet](../../includes/iot-hub-howto-schedule-broadcast-jobs-dotnet.md)] |
| 47 | + |
| 48 | +:::zone-end |
| 49 | + |
| 50 | +:::zone pivot="programming-language-java" |
| 51 | + |
| 52 | +[!INCLUDE [iot-hub-howto-schedule-broadcast-jobs-java](../../includes/iot-hub-howto-schedule-broadcast-jobs-java.md)] |
| 53 | + |
| 54 | +:::zone-end |
| 55 | + |
| 56 | +:::zone pivot="programming-language-python" |
| 57 | + |
| 58 | +[!INCLUDE [iot-hub-howto-schedule-broadcast-jobs-python](../../includes/iot-hub-howto-schedule-broadcast-jobs-python.md)] |
| 59 | + |
| 60 | +:::zone-end |
| 61 | + |
| 62 | +:::zone pivot="programming-language-node" |
| 63 | + |
| 64 | +[!INCLUDE [iot-hub-howto-schedule-broadcast-jobs-node](../../includes/iot-hub-howto-schedule-broadcast-jobs-node.md)] |
| 65 | + |
| 66 | +:::zone-end |
0 commit comments