Class MqttClientConfiguration
The configuration used to connect with the MQTT broker. This is actually a wrapper around the
MQTTnet.MqttClientOptions from the MQTTnet library.
Inheritance
MqttClientConfiguration
Assembly: Silverback.Integration.MQTT.dll
Syntax
public sealed record MqttClientConfiguration : IValidatableSettings, IEquatable<MqttClientConfiguration>
Constructors
MqttClientConfiguration()
The configuration used to connect with the MQTT broker. This is actually a wrapper around the
MQTTnet.MqttClientOptions from the MQTTnet library.
Declaration
public MqttClientConfiguration()
Properties
AcknowledgmentTimeout
Gets the maximum time to wait for the acknowledgment operation to complete. The default is 30 seconds.
Declaration
public TimeSpan AcknowledgmentTimeout { get; init; }
Property Value
AllowPacketFragmentation
Gets a value indicating whether the broker allows packet fragmentation.
Unfortunately not all brokers (like AWS) do support fragmentation and will close the connection when receiving such packets.
If such a service is used this flag must be set to false.
The default is true.
Declaration
public bool AllowPacketFragmentation { get; init; }
Property Value
AuthenticationData
Gets the authentication data to be used for the custom authentication.
Declaration
public byte[]? AuthenticationData { get; init; }
Property Value
AuthenticationMethod
Gets the custom authentication method.
Declaration
public string? AuthenticationMethod { get; init; }
Property Value
BackpressureLimit
Gets the maximum number of messages to be consumed and enqueued waiting to be processed.
The default is 2.
Declaration
public int BackpressureLimit { get; init; }
Property Value
Channel
Declaration
public MqttClientChannelConfiguration? Channel { get; init; }
Property Value
CleanSession
Gets a value indicating whether a clean non-persistent session has to be created for this client. The default is true.
Declaration
public bool CleanSession { get; init; }
Property Value
ClientId
Gets the client identifier. The default is Guid.NewGuid().ToString().
Declaration
public string ClientId { get; init; }
Property Value
ConsumerEndpoints
Gets the configured consumer endpoints.
Declaration
public IValueReadOnlyCollection<MqttConsumerEndpointConfiguration> ConsumerEndpoints { get; init; }
Property Value
Credentials
Gets the credentials to be used to authenticate with the message broker.
Declaration
public IMqttClientCredentialsProvider? Credentials { get; init; }
Property Value
| Type |
Description |
| IMqttClientCredentialsProvider |
|
EnhancedAuthenticationHandler
Gets the handler for AUTH packets. This can happen when connecting or at any time while being already connected.
Declaration
public IMqttEnhancedAuthenticationHandler? EnhancedAuthenticationHandler { get; init; }
Property Value
| Type |
Description |
| IMqttEnhancedAuthenticationHandler |
|
KeepAlivePeriod
Gets the communication timeout. The default is 10 seconds.
Declaration
public TimeSpan KeepAlivePeriod { get; init; }
Property Value
MaxDegreeOfParallelism
Gets the maximum number of incoming messages that can be processed concurrently.
The default is 1.
Declaration
public int MaxDegreeOfParallelism { get; init; }
Property Value
MaximumPacketSize
Gets the maximum packet size in byte the client will process. The default is no limit.
Declaration
public uint MaximumPacketSize { get; init; }
Property Value
ProducerEndpoints
Gets the configured producer endpoints.
Declaration
public IValueReadOnlyCollection<MqttProducerEndpointConfiguration> ProducerEndpoints { get; init; }
Property Value
ProtocolVersion
Gets the MQTT protocol version. The default is MQTTnet.Formatter.MqttProtocolVersion.V500.
Declaration
public MqttProtocolVersion ProtocolVersion { get; init; }
Property Value
| Type |
Description |
| MqttProtocolVersion |
|
ReceiveMaximum
Gets the maximum number of QoS 1 and QoS 2 publications that can be received and processed concurrently. The default value is
null, which means 65'535.
Declaration
public ushort ReceiveMaximum { get; init; }
Property Value
Gets a value indicating whether the reason string or user properties can be sent with any packet. The default is usually
true.
Declaration
public bool RequestProblemInformation { get; init; }
Property Value
Gets a value indicating whether the server should return the response information in the CONNACK packet. The default is
usually false.
Declaration
public bool RequestResponseInformation { get; init; }
Property Value
SessionExpiryInterval
Gets the session expiry interval in seconds. When set to 0 the session will expire when the connection is closed, while
MaxValue indicates that the session will never expire. The default is 0.
Declaration
public uint SessionExpiryInterval { get; init; }
Property Value
Timeout
Gets the timeout which will be applied at socket level and internal operations.
The default value is the same as for sockets in .NET in general.
Declaration
public TimeSpan Timeout { get; init; }
Property Value
TopicAliasMaximum
Gets the maximum number of topic aliases the server can send in the PUBLISH packet. The default is 0, meaning that no
alias can be sent.
Declaration
public ushort TopicAliasMaximum { get; init; }
Property Value
TryPrivate
Gets a value indicating whether the bridge must attempt to indicate to the remote broker that it is a bridge and not an ordinary
client. If successful, this means that the loop detection will be more effective and that the retained messages will be propagated
correctly. Not all brokers support this feature, so it may be necessary to set it to false if your bridge does not connect
properly.
Declaration
public bool TryPrivate { get; init; }
Property Value
UserProperties
Gets the list of user properties to be sent with the CONNECT packet. They can be used to send connection related
properties from the client to the server.
Declaration
public IValueReadOnlyCollection<MqttUserProperty> UserProperties { get; init; }
Property Value
ValidateFeatures
Gets a value indicating whether the client should check if the configuration is valid for the selected protocol version.
The default is true.
Declaration
public bool ValidateFeatures { get; init; }
Property Value
WillMessage
Gets the optional last will message to be sent when the client ungracefully disconnects.
Declaration
public MqttLastWillMessageConfiguration? WillMessage { get; init; }
Property Value
WriterBufferSize
Gets the default and initial size of the packet write buffer. It is recommended to set this to a value close to the usual expected
packet size * 1.5. Do not change this value when no memory issues are experienced.
Declaration
public int WriterBufferSize { get; init; }
Property Value
WriterBufferSizeMax
Gets the maximum size of the buffer writer. The writer will reduce its internal buffer to this value after serializing a
packet. Do not change this value when no memory issues are experienced.
Declaration
public int WriterBufferSizeMax { get; init; }
Property Value
Methods
Equals(MqttClientConfiguration?)
The configuration used to connect with the MQTT broker. This is actually a wrapper around the
MQTTnet.MqttClientOptions from the MQTTnet library.
Declaration
public bool Equals(MqttClientConfiguration? other)
Parameters
Returns
Equals(object?)
The configuration used to connect with the MQTT broker. This is actually a wrapper around the
MQTTnet.MqttClientOptions from the MQTTnet library.
Declaration
public override bool Equals(object? obj)
Parameters
| Type |
Name |
Description |
| object |
obj |
|
Returns
Overrides
GetHashCode()
The configuration used to connect with the MQTT broker. This is actually a wrapper around the
MQTTnet.MqttClientOptions from the MQTTnet library.
Declaration
public override int GetHashCode()
Returns
Overrides
ToString()
The configuration used to connect with the MQTT broker. This is actually a wrapper around the
MQTTnet.MqttClientOptions from the MQTTnet library.
Declaration
public override string ToString()
Returns
Overrides
Validate()
Declaration
Operators
operator ==(MqttClientConfiguration?, MqttClientConfiguration?)
The configuration used to connect with the MQTT broker. This is actually a wrapper around the
MQTTnet.MqttClientOptions from the MQTTnet library.
Declaration
public static bool operator ==(MqttClientConfiguration? left, MqttClientConfiguration? right)
Parameters
Returns
operator !=(MqttClientConfiguration?, MqttClientConfiguration?)
The configuration used to connect with the MQTT broker. This is actually a wrapper around the
MQTTnet.MqttClientOptions from the MQTTnet library.
Declaration
public static bool operator !=(MqttClientConfiguration? left, MqttClientConfiguration? right)
Parameters
Returns
Implements