ModuleClient.SetMessageHandlerAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
SetMessageHandlerAsync(MessageHandler, Object) |
Sets 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) |
Sets 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)
Sets 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
Public Function SetMessageHandlerAsync (messageHandler As MessageHandler, userContext As Object) As 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.
Applies to
SetMessageHandlerAsync(MessageHandler, Object, CancellationToken)
Sets 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
Public Function SetMessageHandlerAsync (messageHandler As MessageHandler, userContext As Object, cancellationToken As CancellationToken) As 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
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應