Class RabbitMQConnectionFactory
Connection factory configuration for RabbitMQ. Register in the route registry
and reference by name in endpoint URIs (connectionFactory=myFactory).
Supports cluster mode via comma-separated hosts.
public sealed class RabbitMQConnectionFactory
Inheritance
Properties
AutomaticRecovery
Enable automatic recovery (default: true).
public bool AutomaticRecovery { get; set; }
ClientCertificate
Client certificate for mutual TLS, with its private key — from the Windows certificate store, a key vault or
public X509Certificate2? ClientCertificate { get; set; }
ConnectionTimeout
Connection timeout in seconds (default: 60). Prevents hangs on unreachable cluster nodes.
public int ConnectionTimeout { get; set; }
ConsumerDispatchConcurrency
Concurrent dispatch limit per connection (default: 1). Controls how many messages the client dispatches concurrently.
public ushort ConsumerDispatchConcurrency { get; set; }
ContinuationTimeout
Timeout for AMQP protocol-level continuations in seconds (default: 30). Prevents indefinite hangs on declare/bind.
public int ContinuationTimeout { get; set; }
CredentialsProvider
Your own source of credentials (), in place of and
public ICredentialsProvider? CredentialsProvider { get; set; }
OAuth2Scope
Requested scopes, space-separated (optional; for RabbitMQ usually rabbitmq.read:/ ...).
public string? OAuth2Scope { get; set; }
OAuth2TokenEndpoint
OAuth 2.0 token endpoint (client credentials grant). Set with and
public string? OAuth2TokenEndpoint { get; set; }
Port
AMQP port (default: 5672; the broker's TLS listener is usually 5671).
public int Port { get; set; }
RecoveryInterval
Network recovery interval in seconds (default: 5).
public int RecoveryInterval { get; set; }
RevocationMode
Revocation check of the broker certificate: (default),
public X509RevocationMode RevocationMode { get; set; }
RevocationSoftFail
Accept a broker certificate whose revocation status cannot be determined. Default false: refused.
public bool RevocationSoftFail { get; set; }
SocketReadTimeout
Socket read timeout in seconds (default: 30). Detects dead TCP connections faster than heartbeat alone.
public int SocketReadTimeout { get; set; }
SocketWriteTimeout
Socket write timeout in seconds (default: 30).
public int SocketWriteTimeout { get; set; }
SslCaCertificates
The root certificates the broker certificate must chain to, instead of the system trust store.
public X509Certificate2Collection? SslCaCertificates { get; set; }
SslCaCertPath
PEM file with the root certificates the broker certificate must chain to, instead of the system trust store.
public string? SslCaCertPath { get; set; }
SslCertPath
Client certificate (PFX) presented for mutual TLS. Or give the certificate itself as .
public string? SslCertPath { get; set; }
SslProtocols
Allowed TLS versions (Tls12, Tls13). (default): the operating system chooses.
public SslProtocols SslProtocols { get; set; }
SslServerName
The name the broker certificate must carry. Unset, each host of the list is checked against its own name; set it
public string? SslServerName { get; set; }
TopologyRecoveryEnabled
Re-declare topology (exchanges, queues, bindings) after recovery (default: true). Critical for cluster.
public bool TopologyRecoveryEnabled { get; set; }
Methods
Build()
Creates a configured pointed at the first host. Open the connection with
public ConnectionFactory Build()
GetEndpoints()
Parses the host list into AMQP endpoints, each carrying the TLS settings: a connection opened over an
public List<AmqpTcpEndpoint> GetEndpoints()
Validate(string)
Throws when the factory's settings contradict each other; called when a connection is opened with it.
public void Validate(string name)