IotHubModuleClient.InvokeMethodAsync Method

Definition

Overloads

InvokeMethodAsync(String, DirectMethodRequest, CancellationToken)

Interactively invokes a method from an edge module to an edge device. Both the edge module and the edge device need to be connected to the same edge hub. IotHubModuleClient instance must be opened already.

InvokeMethodAsync(String, String, DirectMethodRequest, CancellationToken)

Interactively invokes a method from an edge module to a different edge module. Both of the edge modules need to be connected to the same edge hub. IotHubModuleClient instance must be opened already.

InvokeMethodAsync(String, DirectMethodRequest, CancellationToken)

Interactively invokes a method from an edge module to an edge device. Both the edge module and the edge device need to be connected to the same edge hub. IotHubModuleClient instance must be opened already.

public System.Threading.Tasks.Task<Microsoft.Azure.Devices.Client.DirectMethodResponse> InvokeMethodAsync (string deviceId, Microsoft.Azure.Devices.Client.DirectMethodRequest methodRequest, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeMethodAsync : string * Microsoft.Azure.Devices.Client.DirectMethodRequest * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Client.DirectMethodResponse>
Public Function InvokeMethodAsync (deviceId As String, methodRequest As DirectMethodRequest, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DirectMethodResponse)

Parameters

deviceId
String

The unique identifier of the edge device to invoke the method on.

methodRequest
DirectMethodRequest

The details of the method to invoke.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

The result of the method invocation.

Exceptions

Thrown if IotHubModuleClient instance is not opened already.

Thrown when the operation has been canceled.

Remarks

This API call is relevant only for IoT Edge modules.

Applies to

InvokeMethodAsync(String, String, DirectMethodRequest, CancellationToken)

Interactively invokes a method from an edge module to a different edge module. Both of the edge modules need to be connected to the same edge hub. IotHubModuleClient instance must be opened already.

public System.Threading.Tasks.Task<Microsoft.Azure.Devices.Client.DirectMethodResponse> InvokeMethodAsync (string deviceId, string moduleId, Microsoft.Azure.Devices.Client.DirectMethodRequest methodRequest, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeMethodAsync : string * string * Microsoft.Azure.Devices.Client.DirectMethodRequest * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Client.DirectMethodResponse>
Public Function InvokeMethodAsync (deviceId As String, moduleId As String, methodRequest As DirectMethodRequest, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DirectMethodResponse)

Parameters

deviceId
String

The unique identifier of the device.

moduleId
String

The unique identifier of the edge module to invoke the method on.

methodRequest
DirectMethodRequest

The details of the method to invoke.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

The result of the method invocation.

Exceptions

Thrown if IotHubModuleClient instance is not opened already.

Thrown when the operation has been canceled.

Remarks

This API call is relevant only for IoT Edge modules.

Applies to