다음을 통해 공유


ModuleClient.SendEventAsync Method

Definition

Overloads

SendEventAsync(Message)

Sends an event to IoT hub.

SendEventAsync(Message, CancellationToken)

Sends an event to IoT hub.

SendEventAsync(String, Message)

Sends an event to IoT hub.

SendEventAsync(String, Message, CancellationToken)

Sends an event to IoT hub.

SendEventAsync(Message)

Sends an event to IoT hub.

public System.Threading.Tasks.Task SendEventAsync (Microsoft.Azure.Devices.Client.Message message);
member this.SendEventAsync : Microsoft.Azure.Devices.Client.Message -> System.Threading.Tasks.Task
Public Function SendEventAsync (message As Message) As Task

Parameters

message
Message

The message.

Returns

The message containing the event

Exceptions

Thrown when a required parameter is null.

Thrown if the service does not respond to the request within the timeout specified for the operation. The timeout values are largely transport protocol specific. Check the corresponding transport settings to see if they can be configured. The operation timeout for the client can be set using OperationTimeoutInMilliseconds.

Thrown if the client encounters a transient retryable exception.

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.

DotNetty.Transport.Channels.ClosedChannelException

Thrown if the MQTT transport layer closes unexpectedly.

Thrown if an error occurs when communicating with IoT hub service. If IsTransient is set to true then it is a transient exception. If IsTransient is set to false then it is a non-transient exception.

Remarks

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 list of exceptions is not exhaustive.

Applies to

SendEventAsync(Message, CancellationToken)

Sends an event to IoT hub.

public System.Threading.Tasks.Task SendEventAsync (Microsoft.Azure.Devices.Client.Message message, System.Threading.CancellationToken cancellationToken);
member this.SendEventAsync : Microsoft.Azure.Devices.Client.Message * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SendEventAsync (message As Message, cancellationToken As CancellationToken) As Task

Parameters

message
Message

The message.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

The message containing the event

Exceptions

Thrown when a required parameter is null.

Thrown if the service does not respond to the request before the expiration of the passed CancellationToken. If a cancellation token is not supplied to the operation call, a cancellation token with an expiration time of 4 minutes is used.

Thrown if the client encounters a transient retryable exception.

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.

DotNetty.Transport.Channels.ClosedChannelException

Thrown if the MQTT transport layer closes unexpectedly.

Thrown if an error occurs when communicating with IoT hub service. If IsTransient is set to true then it is a transient exception. If IsTransient is set to false then it is a non-transient exception.

Remarks

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 list of exceptions is not exhaustive.

Applies to

SendEventAsync(String, Message)

Sends an event to IoT hub.

public System.Threading.Tasks.Task SendEventAsync (string outputName, Microsoft.Azure.Devices.Client.Message message);
member this.SendEventAsync : string * Microsoft.Azure.Devices.Client.Message -> System.Threading.Tasks.Task
Public Function SendEventAsync (outputName As String, message As Message) As Task

Parameters

outputName
String

The output target for sending the given message.

message
Message

The message to send.

Returns

The message containing the event

Exceptions

Thrown when the operation has been canceled.

Thrown when a required parameter is null.

Thrown if the service does not respond to the request within the timeout specified for the operation. The timeout values are largely transport protocol specific. Check the corresponding transport settings to see if they can be configured. The operation timeout for the client can be set using OperationTimeoutInMilliseconds.

Thrown if the client encounters a transient retryable exception.

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.

DotNetty.Transport.Channels.ClosedChannelException

Thrown if the MQTT transport layer closes unexpectedly.

Thrown if an error occurs when communicating with IoT hub service. If IsTransient is set to true then it is a transient exception. If IsTransient is set to false then it is a non-transient exception.

Remarks

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

SendEventAsync(String, Message, CancellationToken)

Sends an event to IoT hub.

public System.Threading.Tasks.Task SendEventAsync (string outputName, Microsoft.Azure.Devices.Client.Message message, System.Threading.CancellationToken cancellationToken);
member this.SendEventAsync : string * Microsoft.Azure.Devices.Client.Message * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SendEventAsync (outputName As String, message As Message, cancellationToken As CancellationToken) As Task

Parameters

outputName
String

The output target for sending the given message.

message
Message

The message to send.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

The message containing the event

Exceptions

Thrown when a required parameter is null.

Thrown if the service does not respond to the request before the expiration of the passed CancellationToken. If a cancellation token is not supplied to the operation call, a cancellation token with an expiration time of 4 minutes is used.

Thrown if the client encounters a transient retryable exception.

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.

DotNetty.Transport.Channels.ClosedChannelException

Thrown if the MQTT transport layer closes unexpectedly.

Thrown if an error occurs when communicating with IoT hub service. If IsTransient is set to true then it is a transient exception. If IsTransient is set to false then it is a non-transient exception.

Remarks

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