EnsureConnectivityAsync Method
Definition
- Namespace
- Savvyio.Extensions.RabbitMQ
- Assemblies
- Savvyio.Extensions.RabbitMQ.dll
EnsureConnectivityAsync(CancellationToken)
Ensures that a connection and channel to the RabbitMQ broker are established and initialized. This method is thread-safe and will only initialize the connection and channel once.
protected Task EnsureConnectivityAsync(CancellationToken ct)
Parameters
ctCancellationTokenA CancellationToken that can be used to cancel the asynchronous operation.
Returns
Remarks
If the connection and channel are already initialized, this method returns immediately. Otherwise, it acquires an asynchronous lock to ensure only one initialization occurs, then creates the RabbitMQ connection and channel.