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
This article shows you how to create back-end app code to schedule device direct method and device twin desired property updates.
17
+
This article shows you how to create back-end app code to schedule and broadcast jobs.
18
18
19
-
Use Azure IoT Hub to schedule and track jobs that update millions of devices. Use jobs to:
19
+
Use Azure IoT Hub to schedule and track jobs that update up to millions of devices for the following:
20
20
21
21
* Update desired properties
22
22
* Update tags
23
23
* Invoke direct methods
24
24
25
-
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 tracks progress as each of the devices receives and executes the reboot direct method.
25
+
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.
26
26
27
27
To learn more about each of these capabilities, see:
This article describes how to use the [Azure IoT SDK for .NET](https://github.com/Azure/azure-iot-sdk-csharp/blob/main/readme.md) to create backend service application code to schedule job to invoke a direct method or perform a device twin desired property update on one or more devices.
18
+
This article describes how to use the [Azure IoT SDK for .NET](https://github.com/Azure/azure-iot-sdk-csharp/blob/main/readme.md) to create backend service application code to a schedule job to invoke a direct method or perform a device twin desired property update on one or more devices.
19
19
20
-
### Add service NuGet Package
20
+
### Add service NuGet package
21
21
22
22
Backend service applications require the **Microsoft.Azure.Devices** NuGet package.
Use [ScheduleDeviceMethodAsync](/dotnet/api/microsoft.azure.devices.jobclient.scheduledevicemethodasync) to create a new direct method to run a direct method on one or multiple devices.
65
+
Use [ScheduleDeviceMethodAsync](/dotnet/api/microsoft.azure.devices.jobclient.scheduledevicemethodasync) to create a job to run a direct method on one or multiple devices.
66
66
67
-
This example schedules a job for a direct method method named "LockDoor".
67
+
This example schedules a job for a direct method method named "LockDoor" on one device named "Device-1". The device(s) included in the scheduled job are contained second parameter as a query condition.
68
68
69
69
```csharp
70
-
stringmethodJobId=Guid.NewGuid().ToString();
71
-
staticstringdeviceId="Device-1";
70
+
stringmethodJobId=Guid.NewGuid().ToString();// a unique job ID
71
+
staticstringdeviceId="Device-1";// In this example, there is only one device affected.
72
72
73
+
// The CloudToDeviceMethod record specifies the direct method name and device connection timeout.
0 commit comments