Interface IConnectionFactory
public interface IConnectionFactory
Properties
ClientProperties
Dictionary of client properties to be sent to the server.
IDictionary<string, object?> ClientProperties { get; set; }
Property Value
ClientProvidedName
Default client provided name to be used for connections.
string? ClientProvidedName { get; set; }
Property Value
ConsumerDispatchConcurrency
Set to a value greater than one to enable concurrent processing. For a concurrency greater than one IAsyncBasicConsumer will be offloaded to the worker thread pool so it is important to choose the value for the concurrency wisely to avoid thread pool overloading. IAsyncBasicConsumer can handle concurrency much more efficiently due to the non-blocking nature of the consumer. Defaults to 1.
ushort ConsumerDispatchConcurrency { get; set; }
Property Value
Remarks
For concurrency greater than one this removes the guarantee that consumers handle messages in the order they receive them. In addition to that consumers need to be thread/concurrency safe.
ContinuationTimeout
Amount of time protocol operations (e.g.
queue.declare
) are allowed to take before
timing out.
TimeSpan ContinuationTimeout { get; set; }
Property Value
CredentialsProvider
ICredentialsProvider used to obtain username and password.
ICredentialsProvider? CredentialsProvider { get; set; }
Property Value
HandshakeContinuationTimeout
Amount of time protocol handshake operations are allowed to take before timing out.
TimeSpan HandshakeContinuationTimeout { get; set; }
Property Value
Password
Password to use when authenticating to the server.
string Password { get; set; }
Property Value
RequestedChannelMax
Maximum channel number to ask for.
ushort RequestedChannelMax { get; set; }
Property Value
RequestedFrameMax
Frame-max parameter to ask for (in bytes).
uint RequestedFrameMax { get; set; }
Property Value
RequestedHeartbeat
Heartbeat setting to request.
TimeSpan RequestedHeartbeat { get; set; }
Property Value
Uri
Sets or gets the AMQP Uri to be used for connections.
Uri Uri { get; set; }
Property Value
UserName
Username to use when authenticating to the server.
string UserName { get; set; }
Property Value
VirtualHost
Virtual host to access during this connection.
string VirtualHost { get; set; }
Property Value
Methods
AuthMechanismFactory(IEnumerable<string>)
Given a list of mechanism names supported by the server, select a preferred mechanism, or null if we have none in common.
IAuthMechanismFactory? AuthMechanismFactory(IEnumerable<string> mechanismNames)
Parameters
mechanismNames
IEnumerable<string>
Returns
CreateConnectionAsync(IEnumerable<AmqpTcpEndpoint>, string, CancellationToken)
Asynchronously create a connection using a list of endpoints. The selection behaviour can be overridden by configuring the EndpointResolverFactory.
Task<IConnection> CreateConnectionAsync(IEnumerable<AmqpTcpEndpoint> endpoints, string clientProvidedName, CancellationToken cancellationToken = default)
Parameters
endpoints
IEnumerable<AmqpTcpEndpoint>List of endpoints to use for the initial connection and recovery.
clientProvidedName
stringApplication-specific connection name, will be displayed in the management UI if RabbitMQ server supports it. This value doesn't have to be unique and cannot be used as a connection identifier, e.g. in HTTP API requests. This value is supposed to be human-readable.
cancellationToken
CancellationTokenCancellation token for this connection
Returns
- Task<IConnection>
Open connection
Exceptions
- BrokerUnreachableException
When no hostname was reachable.
CreateConnectionAsync(IEnumerable<AmqpTcpEndpoint>, CancellationToken)
Asynchronously create a connection using a list of endpoints. The selection behaviour can be overridden by configuring the EndpointResolverFactory.
Task<IConnection> CreateConnectionAsync(IEnumerable<AmqpTcpEndpoint> endpoints, CancellationToken cancellationToken = default)
Parameters
endpoints
IEnumerable<AmqpTcpEndpoint>List of endpoints to use for the initial connection and recovery.
cancellationToken
CancellationTokenCancellation token for this connection
Returns
- Task<IConnection>
Open connection
Exceptions
- BrokerUnreachableException
When no hostname was reachable.
CreateConnectionAsync(IEnumerable<string>, string, CancellationToken)
Asynchronously connects to the first reachable hostname from the list.
Task<IConnection> CreateConnectionAsync(IEnumerable<string> hostnames, string clientProvidedName, CancellationToken cancellationToken = default)
Parameters
hostnames
IEnumerable<string>List of host names to use
clientProvidedName
stringApplication-specific connection name, will be displayed in the management UI if RabbitMQ server supports it. This value doesn't have to be unique and cannot be used as a connection identifier, e.g. in HTTP API requests. This value is supposed to be human-readable.
cancellationToken
CancellationTokenCancellation token for this connection
Returns
- Task<IConnection>
Open connection
CreateConnectionAsync(IEnumerable<string>, CancellationToken)
Asynchronously connects to the first reachable hostname from the list.
Task<IConnection> CreateConnectionAsync(IEnumerable<string> hostnames, CancellationToken cancellationToken = default)
Parameters
hostnames
IEnumerable<string>List of host names to use
cancellationToken
CancellationTokenCancellation token for this connection
Returns
- Task<IConnection>
Open connection
CreateConnectionAsync(string, CancellationToken)
Asynchronously create a connection to the specified endpoint.
Task<IConnection> CreateConnectionAsync(string clientProvidedName, CancellationToken cancellationToken = default)
Parameters
clientProvidedName
stringApplication-specific connection name, will be displayed in the management UI if RabbitMQ server supports it. This value doesn't have to be unique and cannot be used as a connection identifier, e.g. in HTTP API requests. This value is supposed to be human-readable.
cancellationToken
CancellationTokenCancellation token for this connection
Returns
- Task<IConnection>
Open connection
CreateConnectionAsync(CancellationToken)
Asynchronously create a connection to the specified endpoint.
Task<IConnection> CreateConnectionAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenCancellation token for this connection