Class ClientOptions
Represents the configuration options for the NMS AMQP client, including connection string and redelivery policy.
Inherited Members
Namespace: CodersRealm.AmqpClient
Assembly: CodersRealm.AmqpClient.dll
Syntax
public sealed class ClientOptions
Properties
AmqpVhosts
Gets or sets the virtual hosts (vhosts) to connect to on the AMQP brokers. This can be a single vhost or multiple vhosts for failover scenarios.
Declaration
public string[]? AmqpVhosts { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] |
ClientId
The client id that is applied to the connection.
Declaration
public string? ClientId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ClientIdPrefix
Optional prefix value that is used for generated Client ID values. The default prefix is 'ID:'.
Declaration
public string? ClientIdPrefix { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ConnectionIdPrefix
Optional prefix value that is used for generated Connection ID values when a new Connection is created. This connection ID is used when logging some information from the connection object so a configurable prefix can make breadcrumbing the logs easier. The default prefix is 'ID:'.
Declaration
public string? ConnectionIdPrefix { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ConnectionString
Gets or sets the connection string used to establish the AMQP connection. If set then all other connection settings are ignored.
Declaration
public string? ConnectionString { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
EnableFailOver
Gets or sets a value indicating whether failover is enabled for the AMQP connection. If true, the client will attempt to connect to alternative brokers in case of connection failures.
Declaration
public bool? EnableFailOver { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? |
FailoverInitialReconnectDelay
The amount of time the client will wait before the first attempt to reconnect to a remote peer. The default value is zero, meaning the first attempt happens immediately.
Declaration
public long? FailoverInitialReconnectDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| long? |
FailoverMaxReconnectAttempts
The number of reconnection attempts allowed before reporting the connection as failed to the client. The default is no limit or (-1).
Declaration
public int? FailoverMaxReconnectAttempts { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
FailoverMaxReconnectDelay
The maximum time that the client will wait before attempting a reconnect. This value is only used when the backoff feature is enabled to ensure that the delay doesn't not grow too large. Defaults to 30 seconds as the max time between connect attempts.
Declaration
public long? FailoverMaxReconnectDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| long? |
FailoverReconnectBackOffMultiplier
The multiplier used to grow the reconnection delay value, defaults to 2.0d.
Declaration
public double? FailoverReconnectBackOffMultiplier { get; set; }
Property Value
| Type | Description |
|---|---|
| double? |
FailoverReconnectDelay
Controls the delay between successive reconnection attempts, defaults to 10 milliseconds. If the backoff option is not enabled this value remains constant.
Declaration
public long? FailoverReconnectDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| long? |
FailoverReconnectDelayRandomFactor
Reconnect backoff random factor. 0 means no randomisation. 0.5 would mean backoff time could be (pseudo) randomly between 0.5 and 1.5 of normal reconnect backoff time. 1 would mean backoff time could be between 0 and 2x normal reconnect backoff. 2 would mean backoff time between 0 and 3x normal backoff, and so on. Default value is 0.
Declaration
public double? FailoverReconnectDelayRandomFactor { get; set; }
Property Value
| Type | Description |
|---|---|
| double? |
FailoverStartupMaxReconnectAttempts
For a client that has never connected to a remote peer before this option control how many attempts are made to connect before reporting the connection as failed. The default is to use the value of maxReconnectAttempts.
Declaration
public int? FailoverStartupMaxReconnectAttempts { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
FailoverUseReconnectBackOff
Controls whether the time between reconnection attempts should grow based on a configured multiplier. This option defaults to true.
Declaration
public bool? FailoverUseReconnectBackOff { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? |
HostNames
Gets or sets the host names of the AMQP brokers to connect to. This can be a single host or multiple hosts for failover scenarios.
Declaration
public string[]? HostNames { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] |
LocalMessageExpiry
An option that controls whether consumers and subscribes will filter out and destroy expired messages that are already sitting inside its prefetch buffer, or deliver them to your code anyway.
Declaration
public bool? LocalMessageExpiry { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? | By default this value is set to true and expired messages will be filtered. |
MaxNewConnectionRatePerSec
The rate limit for how fast connections to the message broker are created. It is used to prevent connection storms.
Declaration
public double? MaxNewConnectionRatePerSec { get; set; }
Property Value
| Type | Description |
|---|---|
| double? | The default is -1 (unlimited). Otherwise set to a positvie number. |
Password
The password used to authenticate the connection.
Declaration
public string? Password { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Ports
Gets or sets the port numbers corresponding to the host names for the AMQP connection. This can be a single port or multiple ports for failover scenarios.
Declaration
public ushort[]? Ports { get; set; }
Property Value
| Type | Description |
|---|---|
| ushort[] |
PrefetchPolicy
Sets the initial AMQP "link credit" (the prefetch size) for all message consumers and subscribers.
Declaration
public int? PrefetchPolicy { get; set; }
Property Value
| Type | Description |
|---|---|
| int? | The default is 1000. Range: 0 to 2,147,483,647 |
RedeliveryPolicy
Gets or sets the redelivery policy for message processing, which defines how messages are redelivered in case of failures.
Declaration
public IRedeliveryPolicy? RedeliveryPolicy { get; set; }
Property Value
| Type | Description |
|---|---|
| IRedeliveryPolicy |
RequestTimeout
The timeout value that controls how long the client waits on completion of various blocking interactions before returning an error. By default the client will wait indefinitely for a request to complete.
Declaration
public long? RequestTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| long? |
TransportReceiveBufferSize
Specifies the send buffer size option of the TCP socket.
Declaration
public int? TransportReceiveBufferSize { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
TransportReceiveTimeout
Specifies the receive timeout option of the TCP socket.
Declaration
public int? TransportReceiveTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
TransportSendBufferSize
Specifies the receive buffer size option of the TCP socket.
Declaration
public int? TransportSendBufferSize { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
TransportSendTimeout
Specifies the send timeout option of the TCP socket.
Declaration
public int? TransportSendTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
TransportTcpKeepAliveInterval
Specifies how often a keep-alive transmission is sent when no response is received from previous keep-alive transmissions.
Declaration
public int? TransportTcpKeepAliveInterval { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
TransportTcpKeepAliveTime
Specifies how often a keep-alive transmission is sent to an idle connection.
Declaration
public int? TransportTcpKeepAliveTime { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
TransportTcpNoDelay
Specifies the NoDelay option of the TCP socket.
Declaration
public bool? TransportTcpNoDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? |
UseSslTls
Gets or sets a value indicating whether SSL/TLS should be used for the AMQP connection. If true, the connection will be secured using SSL/TLS.
Declaration
public bool? UseSslTls { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? |
UserName
The user name used to authenticate the connection.
Declaration
public string? UserName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |