Share via


ModuleClient Class

Definition

Contains methods that a module can use to send messages to and receive from the service and interact with module twins.

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

Properties

DiagnosticSamplingPercentage

The diagnostic sampling percentage.

OperationTimeoutInMilliseconds

Stores the timeout used in the operation retries. Note that this value is ignored for operations where a cancellation token is provided. For example, SendEventAsync(Message) will use this timeout, but SendEventAsync(Message, CancellationToken) will not. The latter operation will only be canceled by the provided cancellation token.

ProductInfo

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

Methods

AbandonAsync(Message)

Puts a received message back onto the module queue.

AbandonAsync(Message, CancellationToken)

Puts a received message back onto the module queue.

AbandonAsync(String)

Puts a received message back onto the module queue.

AbandonAsync(String, CancellationToken)

Puts a received message back onto the module queue.

CloseAsync()

Close the ModuleClient instance.

CloseAsync(CancellationToken)

Close the ModuleClient instance.

CompleteAsync(Message)

Deletes a received message from the module queue.

CompleteAsync(Message, CancellationToken)

Deletes a received message from the module queue.

CompleteAsync(String)

Deletes a received message from the module queue.

CompleteAsync(String, CancellationToken)

Deletes a received message from the module queue.

Create(String, IAuthenticationMethod, ClientOptions)

Creates an AMQP ModuleClient from individual parameters.

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

Creates a ModuleClient from individual parameters.

Create(String, IAuthenticationMethod, TransportType, ClientOptions)

Creates a ModuleClient from individual parameters.

Create(String, String, IAuthenticationMethod, ClientOptions)

Creates an AMQP ModuleClient from individual parameters.

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

Creates a ModuleClient from individual parameters.

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

Creates a ModuleClient from individual parameters.

CreateFromConnectionString(String, ClientOptions)

Creates a ModuleClient using AMQP transport from the specified connection string.

CreateFromConnectionString(String, ITransportSettings[], ClientOptions)

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

CreateFromConnectionString(String, TransportType, ClientOptions)

Creates ModuleClient from the specified connection string using the specified transport type.

CreateFromEnvironmentAsync(ClientOptions)

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

CreateFromEnvironmentAsync(ITransportSettings[], ClientOptions)

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

CreateFromEnvironmentAsync(TransportType, ClientOptions)

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

Dispose()

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

Dispose(Boolean)

Releases the unmanaged resources used by the ModuleClient and allows for any derived class to override and provide custom implementation.

GetTwinAsync()

Retrieve a module twin object for the current module.

GetTwinAsync(CancellationToken)

Retrieve a module twin object for the current module.

InvokeMethodAsync(String, MethodRequest)

Interactively invokes a method from an edge module to an edge device. Both the edge module and the edge device need to be connected to the same edge hub.

InvokeMethodAsync(String, MethodRequest, CancellationToken)

Interactively invokes a method from an edge module to an edge device. Both the edge module and the edge device need to be connected to the same edge hub.

InvokeMethodAsync(String, String, MethodRequest)

Interactively invokes a method from an edge module to a different edge module. Both of the edge modules need to be connected to the same edge hub.

InvokeMethodAsync(String, String, MethodRequest, CancellationToken)

Interactively invokes a method from an edge module to a different edge module. Both of the edge modules need to be connected to the same edge hub.

OpenAsync()

Explicitly open the ModuleClient instance.

OpenAsync(CancellationToken)

Explicitly open the ModuleClient instance.

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.

SendEventBatchAsync(IEnumerable<Message>)

Sends a batch of events to IoT hub. Use AMQP or HTTPs for a true batch operation. MQTT will just send the messages one after the other. For more information on IoT Edge module routing https://docs.microsoft.com/azure/iot-edge/module-composition?view=iotedge-2018-06#declare-routes.

SendEventBatchAsync(IEnumerable<Message>, CancellationToken)

Sends a batch of events to IoT hub. Use AMQP or HTTPs for a true batch operation. MQTT will just send the messages one after the other. For more information on IoT Edge module routing https://docs.microsoft.com/azure/iot-edge/module-composition?view=iotedge-2018-06#declare-routes.

SendEventBatchAsync(String, IEnumerable<Message>)

Sends a batch of events to IoT hub. Use AMQP or HTTPs for a true batch operation. MQTT will just send the messages one after the other. For more information on IoT Edge module routing https://docs.microsoft.com/azure/iot-edge/module-composition?view=iotedge-2018-06#declare-routes

SendEventBatchAsync(String, IEnumerable<Message>, CancellationToken)

Sends a batch of events to IoT hub. Use AMQP or HTTPs for a true batch operation. MQTT will just send the messages one after the other. For more information on IoT Edge module routing https://docs.microsoft.com/azure/iot-edge/module-composition?view=iotedge-2018-06#declare-routes

SetConnectionStatusChangesHandler(ConnectionStatusChangesHandler)

Sets a new delegate for the connection status changed callback. If a delegate is already associated, it will be replaced with the new delegate. Note that this callback will never be called if the client is configured to use HTTP as that protocol is stateless

SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, Object)

Set a callback that will be called whenever the client receives a state update (desired or reported) from the service. Set callback value to null to clear.

SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback, Object, CancellationToken)

Set a callback that will be called whenever the client receives a state update (desired or reported) from the service. Set callback value to null to clear.

SetInputMessageHandlerAsync(String, MessageHandler, Object)

Sets 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)

Sets 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)

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.

SetMethodDefaultHandlerAsync(MethodCallback, Object)

Sets 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. A method handler can be unset by passing a null MethodCallback.

SetMethodDefaultHandlerAsync(MethodCallback, Object, CancellationToken)

Sets 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. A method handler can be unset by passing a null MethodCallback.

SetMethodHandlerAsync(String, MethodCallback, Object)

Sets 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. A method handler can be unset by passing a null MethodCallback.

SetMethodHandlerAsync(String, MethodCallback, Object, CancellationToken)

Sets 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. A method handler can be unset by passing a null MethodCallback.

SetRetryPolicy(IRetryPolicy)

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

UpdateReportedPropertiesAsync(TwinCollection)

Push reported property changes up to the service.

UpdateReportedPropertiesAsync(TwinCollection, CancellationToken)

Push reported property changes up to the service.

Applies to