IotHubModuleClient.SendTelemetryAsync Method

Definition

Sends an event to IoT hub. IotHubModuleClient instance must be opened already.

public System.Threading.Tasks.Task SendTelemetryAsync (string outputName, Microsoft.Azure.Devices.Client.TelemetryMessage message, System.Threading.CancellationToken cancellationToken = default);
override this.SendTelemetryAsync : string * Microsoft.Azure.Devices.Client.TelemetryMessage * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SendTelemetryAsync (outputName As String, message As TelemetryMessage, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

outputName
String

The output target for sending the given message.

message
TelemetryMessage

The message to send.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

Exceptions

Thrown when a required parameter is null.

Thrown when the operation has been canceled.

Thrown if ModuleClient instance is not opened already.

Thrown if a socket error occurs.

Thrown if an error occurs when performing an operation on a WebSocket connection.

Thrown if an I/O error occurs.

Thrown if an error occurs when communicating with IoT hub service.

Remarks

For more information on IoT Edge module routing https://docs.microsoft.com/azure/iot-edge/module-composition?view=iotedge-2018-06#declare-routes.

In case of a transient issue, retrying the operation should work. In case of a non-transient issue, inspect the error details and take steps accordingly. Please note that the above list is not exhaustive.

Applies to