Table of Contents

Interface IEnvironment

Namespace
RabbitMQ.AMQP.Client
Assembly
RabbitMQ.AMQP.Client.dll

The IEnvironment is the main entry point to a node or a cluster of nodes.

The CreateConnectionAsync(ConnectionSettings) and parameterless CreateConnectionAsync() methods allow creating IConnection instances. Connection affinity can be configured via Affinity, typically using a ConnectionSettingsBuilder.Affinity(...) call when constructing the settings. An application is expected to maintain a single IEnvironment instance and to close that instance upon application exit.

IEnvironment instances are expected to be thread-safe.

public interface IEnvironment

Methods

CloseAsync()

Close this environment and its resources.

Task CloseAsync()

Returns

Task

Task

CreateConnectionAsync(ConnectionSettings, CancellationToken)

Create a new IConnection with the given connection settings.

Task<IConnection> CreateConnectionAsync(ConnectionSettings connectionSettings, CancellationToken cancellationToken = default)

Parameters

connectionSettings ConnectionSettings
cancellationToken CancellationToken

Returns

Task<IConnection>

Task<TResult> instance.

CreateConnectionAsync(CancellationToken)

Create a new IConnection with the default connection settings.

Task<IConnection> CreateConnectionAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<IConnection>

Task<TResult> instance.