ModuleClient.SetMessageHandlerAsync Method

Definition

Overloads

SetMessageHandlerAsync(MessageHandler, Object)

Registers a new default delegate which applies to all endpoints. If a delegate is already associated with the input, it will be called, else the default delegate will be called. If a default delegate was set previously, it will be overwritten.

SetMessageHandlerAsync(MessageHandler, Object, CancellationToken)

Registers a new default delegate which applies to all endpoints. If a delegate is already associated with the input, it will be called, else the default delegate will be called. If a default delegate was set previously, it will be overwritten.

SetMessageHandlerAsync(MessageHandler, Object)

Registers a new default delegate which applies to all endpoints. If a delegate is already associated with the input, it will be called, else the default delegate will be called. If a default delegate was set previously, it will be overwritten.

public System.Threading.Tasks.Task SetMessageHandlerAsync (Microsoft.Azure.Devices.Client.MessageHandler messageHandler, object userContext);
member this.SetMessageHandlerAsync : Microsoft.Azure.Devices.Client.MessageHandler * obj -> System.Threading.Tasks.Task

Parameters

messageHandler
MessageHandler

The delegate to be called when a message is sent to any input.

userContext
Object

generic parameter to be interpreted by the client code.

Returns

The task containing the event

Exceptions

Thrown when the operation has been canceled.

SetMessageHandlerAsync(MessageHandler, Object, CancellationToken)

Registers a new default delegate which applies to all endpoints. If a delegate is already associated with the input, it will be called, else the default delegate will be called. If a default delegate was set previously, it will be overwritten.

public System.Threading.Tasks.Task SetMessageHandlerAsync (Microsoft.Azure.Devices.Client.MessageHandler messageHandler, object userContext, System.Threading.CancellationToken cancellationToken);
member this.SetMessageHandlerAsync : Microsoft.Azure.Devices.Client.MessageHandler * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

messageHandler
MessageHandler

The delegate to be called when a message is sent to any input.

userContext
Object

generic parameter to be interpreted by the client code.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

The task containing the event

Exceptions

Thrown when the operation has been canceled.

Applies to