Table of Contents

Class MqttSessionClientOptions

Namespace
Azure.Iot.Operations.Mqtt.Session
Assembly
Azure.Iot.Operations.Mqtt.dll

The optional parameters that can be specified when creating a session client.

public class MqttSessionClientOptions : OrderedAckMqttClientOptions
Inheritance
MqttSessionClientOptions
Inherited Members

Properties

ConnectionAttemptTimeout

How long to wait for a single connection attempt to finish before abandoning it.

public TimeSpan ConnectionAttemptTimeout { get; set; }

Property Value

TimeSpan

Remarks

This value allows for you to configure the connection attempt timeout for both initial connection and reconnection scenarios. Note that this value is ignored for the initial connect attempt if RetryOnFirstConnect is false.

ConnectionRetryPolicy

The retry policy that the session client will consult each time it attempts to reconnect and/or each time it attempts the initial connect.

public IRetryPolicy ConnectionRetryPolicy { get; set; }

Property Value

IRetryPolicy

Remarks

By default, this is an ExponentialBackoffRetryPolicy that runs for around 4 minutes. Users may implement custom retry policies instead if they prefer to use a different retry algorithm.

This value cannot be null.

EnableMqttLogging

True if you want the session client to enable MQTT-level logs. False if you do not want these logs.

public bool EnableMqttLogging { get; set; }

Property Value

bool

MaxPendingMessages

The maximum number of publishes, subscribes, or unsubscribes that will be allowed to be enqueued locally at a time.

public uint MaxPendingMessages { get; set; }

Property Value

uint

Remarks

Publishes, subscribes and unsubscribes all occupy separate queues, so this max value is for each of those queues..

PendingMessagesOverflowStrategy

The strategy for the session client to use when deciding how to handle enqueueing a message when the queue is already full.

public MqttPendingMessagesOverflowStrategy PendingMessagesOverflowStrategy { get; set; }

Property Value

MqttPendingMessagesOverflowStrategy

RetryOnFirstConnect

If true, this client will use the same retry policy when first connecting as it would during a reconnection. If false, this client will only make one attempt to connect when calling MqttSessionClient.ConnectAsync(MQTTnet.MqttClientOptions, CancellationToken).

public bool RetryOnFirstConnect { get; set; }

Property Value

bool

Remarks

Generally, this field should be set to true since you can expect mostly the same set of errors when initially connecting compared to when reconnecting. However, there are some exceptions that you are likely to see when initially connecting if you have a misconfiguration somewhere. This value is false by default so that these configuration errors are easier to catch.