ModuleClient ModuleClient ModuleClient Class

Definition

Contains methods that a device can use to send messages to and receive from the service.

public sealed class ModuleClient : IDisposable
type ModuleClient = class
    interface IDisposable
Public NotInheritable Class ModuleClient
Implements IDisposable
Inheritance
ModuleClientModuleClientModuleClient
Implements

Properties

DiagnosticSamplingPercentage DiagnosticSamplingPercentage DiagnosticSamplingPercentage

The diagnostic sampling percentage.

OperationTimeoutInMilliseconds OperationTimeoutInMilliseconds OperationTimeoutInMilliseconds

Stores the timeout used in the operation retries.

ProductInfo ProductInfo ProductInfo

Stores custom product information that will be appended to the user agent string that is sent to IoT Hub.

Methods

AbandonAsync(Message) AbandonAsync(Message) AbandonAsync(Message)

Puts a received message back onto the device queue

AbandonAsync(String) AbandonAsync(String) AbandonAsync(String)

Puts a received message back onto the device queue

AbandonAsync(Message, CancellationToken) AbandonAsync(Message, CancellationToken) AbandonAsync(Message, CancellationToken)

Puts a received message back onto the device queue

AbandonAsync(String, CancellationToken) AbandonAsync(String, CancellationToken) AbandonAsync(String, CancellationToken)

Puts a received message back onto the device queue

CloseAsync() CloseAsync() CloseAsync()

Close the DeviceClient instance

CloseAsync(CancellationToken) CloseAsync(CancellationToken) CloseAsync(CancellationToken)

Close the DeviceClient instance

CompleteAsync(Message) CompleteAsync(Message) CompleteAsync(Message)

Deletes a received message from the device queue

CompleteAsync(String) CompleteAsync(String) CompleteAsync(String)

Deletes a received message from the device queue

CompleteAsync(Message, CancellationToken) CompleteAsync(Message, CancellationToken) CompleteAsync(Message, CancellationToken)

Deletes a received message from the device queue

CompleteAsync(String, CancellationToken) CompleteAsync(String, CancellationToken) CompleteAsync(String, CancellationToken)

Deletes a received message from the device queue

Create(String, String, IAuthenticationMethod, TransportType) Create(String, String, IAuthenticationMethod, TransportType) Create(String, String, IAuthenticationMethod, TransportType)

Create a ModuleClient from individual parameters

Create(String, String, IAuthenticationMethod, ITransportSettings[]) Create(String, String, IAuthenticationMethod, ITransportSettings[]) Create(String, String, IAuthenticationMethod, ITransportSettings[])

Create a ModuleClient from individual parameters

Create(String, String, IAuthenticationMethod) Create(String, String, IAuthenticationMethod) Create(String, String, IAuthenticationMethod)

Create an Amqp ModuleClient from individual parameters

Create(String, IAuthenticationMethod, ITransportSettings[]) Create(String, IAuthenticationMethod, ITransportSettings[]) Create(String, IAuthenticationMethod, ITransportSettings[])

Create a ModuleClient from individual parameters

Create(String, IAuthenticationMethod) Create(String, IAuthenticationMethod) Create(String, IAuthenticationMethod)

Create an Amqp ModuleClient from individual parameters

Create(String, IAuthenticationMethod, TransportType) Create(String, IAuthenticationMethod, TransportType) Create(String, IAuthenticationMethod, TransportType)

Create a ModuleClient from individual parameters

CreateFromConnectionString(String) CreateFromConnectionString(String) CreateFromConnectionString(String)

Create a ModuleClient using Amqp transport from the specified connection string

CreateFromConnectionString(String, ITransportSettings[]) CreateFromConnectionString(String, ITransportSettings[]) CreateFromConnectionString(String, ITransportSettings[])

Create ModuleClient from the specified connection string using a prioritized list of transports

CreateFromConnectionString(String, TransportType) CreateFromConnectionString(String, TransportType) CreateFromConnectionString(String, TransportType)

Create ModuleClient from the specified connection string using the specified transport type

CreateFromEnvironmentAsync() CreateFromEnvironmentAsync() CreateFromEnvironmentAsync()

Creates a ModuleClient instance in an IoT Edge deployment based on environment variables.

CreateFromEnvironmentAsync(ITransportSettings[]) CreateFromEnvironmentAsync(ITransportSettings[]) CreateFromEnvironmentAsync(ITransportSettings[])

Creates a ModuleClient instance in an IoT Edge deployment based on environment variables.

CreateFromEnvironmentAsync(TransportType) CreateFromEnvironmentAsync(TransportType) CreateFromEnvironmentAsync(TransportType)

Creates a ModuleClient instance in an IoT Edge deployment based on environment variables.

Dispose() Dispose() Dispose()

Releases the unmanaged resources used by the DeviceClient and optionally disposes of the managed resources.

GetTwinAsync() GetTwinAsync() GetTwinAsync()

Retrieve a device twin object for the current device.

GetTwinAsync(CancellationToken) GetTwinAsync(CancellationToken) GetTwinAsync(CancellationToken)

Retrieve a device twin object for the current device.

InvokeMethodAsync(String, String, MethodRequest, CancellationToken) InvokeMethodAsync(String, String, MethodRequest, CancellationToken) InvokeMethodAsync(String, String, MethodRequest, CancellationToken)

Interactively invokes a method on module

InvokeMethodAsync(String, String, MethodRequest) InvokeMethodAsync(String, String, MethodRequest) InvokeMethodAsync(String, String, MethodRequest)

Interactively invokes a method on module

InvokeMethodAsync(String, MethodRequest, CancellationToken) InvokeMethodAsync(String, MethodRequest, CancellationToken) InvokeMethodAsync(String, MethodRequest, CancellationToken)

Interactively invokes a method on device

InvokeMethodAsync(String, MethodRequest) InvokeMethodAsync(String, MethodRequest) InvokeMethodAsync(String, MethodRequest)

Interactively invokes a method on device

OpenAsync() OpenAsync() OpenAsync()

Explicitly open the DeviceClient instance.

OpenAsync(CancellationToken) OpenAsync(CancellationToken) OpenAsync(CancellationToken)

Explicitly open the DeviceClient instance.

A cancellation token to cancel the operation.Thrown when the operation has been canceled.
SendEventAsync(Message) SendEventAsync(Message) SendEventAsync(Message)

Sends an event to device hub

SendEventAsync(Message, CancellationToken) SendEventAsync(Message, CancellationToken) SendEventAsync(Message, CancellationToken)

Sends an event to device hub

SendEventAsync(String, Message) SendEventAsync(String, Message) SendEventAsync(String, Message)

Sends an event to device hub.

SendEventAsync(String, Message, CancellationToken) SendEventAsync(String, Message, CancellationToken) SendEventAsync(String, Message, CancellationToken)

Sends an event to device hub.

SendEventBatchAsync(IEnumerable<Message>) SendEventBatchAsync(IEnumerable<Message>) SendEventBatchAsync(IEnumerable<Message>)

Sends a batch of events to device hub

SendEventBatchAsync(IEnumerable<Message>, CancellationToken) SendEventBatchAsync(IEnumerable<Message>, CancellationToken) SendEventBatchAsync(IEnumerable<Message>, CancellationToken)

Sends a batch of events to device hub

SendEventBatchAsync(String, IEnumerable<Message>) SendEventBatchAsync(String, IEnumerable<Message>) SendEventBatchAsync(String, IEnumerable<Message>)

Sends a batch of events to device hub

SendEventBatchAsync(String, IEnumerable<Message>, CancellationToken) SendEventBatchAsync(String, IEnumerable<Message>, CancellationToken) SendEventBatchAsync(String, IEnumerable<Message>, CancellationToken)

Sends a batch of events to device hub

SetConnectionStatusChangesHandler(ConnectionStatusChangesHandler) SetConnectionStatusChangesHandler(ConnectionStatusChangesHandler) SetConnectionStatusChangesHandler(ConnectionStatusChangesHandler)

Registers a new delegate for the connection status changed callback. If a delegate is already associated, it will be replaced with the new delegate.

The name of the method to associate with the delegate.
SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, Object) SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, Object) SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, Object)

Set a callback that will be called whenever the client receives a state update (desired or reported) from the service. This has the side-effect of subscribing to the PATCH topic on the service.

SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, Object, CancellationToken) SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, Object, CancellationToken) SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, Object, CancellationToken)

Set a callback that will be called whenever the client receives a state update (desired or reported) from the service. This has the side-effect of subscribing to the PATCH topic on the service.

SetInputMessageHandlerAsync(String, MessageHandler, Object) SetInputMessageHandlerAsync(String, MessageHandler, Object) SetInputMessageHandlerAsync(String, MessageHandler, Object)

Registers a new delegate for the particular input. If a delegate is already associated with the input, it will be replaced with the new delegate.

SetInputMessageHandlerAsync(String, MessageHandler, Object, CancellationToken) SetInputMessageHandlerAsync(String, MessageHandler, Object, CancellationToken) SetInputMessageHandlerAsync(String, MessageHandler, Object, CancellationToken)

Registers a new delegate for the particular input. If a delegate is already associated with the input, it will be replaced with the new delegate.

SetMessageHandlerAsync(MessageHandler, Object) SetMessageHandlerAsync(MessageHandler, Object) 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) SetMessageHandlerAsync(MessageHandler, Object, CancellationToken) 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.

SetMethodDefaultHandlerAsync(MethodCallback, Object) SetMethodDefaultHandlerAsync(MethodCallback, Object) SetMethodDefaultHandlerAsync(MethodCallback, Object)

Registers a new delegate that is called for a method that doesn't have a delegate registered for its name. If a default delegate is already registered it will replace with the new delegate.

SetMethodDefaultHandlerAsync(MethodCallback, Object, CancellationToken) SetMethodDefaultHandlerAsync(MethodCallback, Object, CancellationToken) SetMethodDefaultHandlerAsync(MethodCallback, Object, CancellationToken)

Registers a new delegate that is called for a method that doesn't have a delegate registered for its name. If a default delegate is already registered it will replace with the new delegate.

SetMethodHandlerAsync(String, MethodCallback, Object) SetMethodHandlerAsync(String, MethodCallback, Object) SetMethodHandlerAsync(String, MethodCallback, Object)

Registers a new delegate for the named method. If a delegate is already associated with the named method, it will be replaced with the new delegate.

The name of the method to associate with the delegate.The delegate to be used when a method with the given name is called by the cloud service.generic parameter to be interpreted by the client code.
SetMethodHandlerAsync(String, MethodCallback, Object, CancellationToken) SetMethodHandlerAsync(String, MethodCallback, Object, CancellationToken) SetMethodHandlerAsync(String, MethodCallback, Object, CancellationToken)

Registers a new delegate for the named method. If a delegate is already associated with the named method, it will be replaced with the new delegate.

The name of the method to associate with the delegate.The delegate to be used when a method with the given name is called by the cloud service.generic parameter to be interpreted by the client code.A cancellation token to cancel the operation.Thrown when the operation has been canceled.
SetRetryPolicy(IRetryPolicy) SetRetryPolicy(IRetryPolicy) SetRetryPolicy(IRetryPolicy)

Sets the retry policy used in the operation retries. The change will take effect after any in-progress operations.

UpdateReportedPropertiesAsync(TwinCollection) UpdateReportedPropertiesAsync(TwinCollection) UpdateReportedPropertiesAsync(TwinCollection)

Push reported property changes up to the service.

UpdateReportedPropertiesAsync(TwinCollection, CancellationToken) UpdateReportedPropertiesAsync(TwinCollection, CancellationToken) UpdateReportedPropertiesAsync(TwinCollection, CancellationToken)

Push reported property changes up to the service.

Applies to