Bagikan melalui


IotHubBaseClient.SetDesiredPropertyUpdateCallbackAsync Method

Definition

Set a callback that will be called whenever the client receives a desired state update from the service. The client instance must be opened already.

public System.Threading.Tasks.Task SetDesiredPropertyUpdateCallbackAsync (Func<Microsoft.Azure.Devices.Client.DesiredProperties,System.Threading.Tasks.Task> callback, System.Threading.CancellationToken cancellationToken = default);
member this.SetDesiredPropertyUpdateCallbackAsync : Func<Microsoft.Azure.Devices.Client.DesiredProperties, System.Threading.Tasks.Task> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SetDesiredPropertyUpdateCallbackAsync (callback As Func(Of DesiredProperties, Task), Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

callback
Func<DesiredProperties,Task>

The callback to be invoked when a desired property update is received from the service.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

Exceptions

Thrown when the operation has been canceled.

Remarks

Calling this API more than once will result in the callback set last overwriting any previously set callback. A method callback can be unset by setting callback to null.

This has the side-effect of subscribing to the PATCH topic on the service.

Applies to