Show / Hide Table of Contents

Class Client

Represents a reusable AMQP client that manages an underlying connection and provides access to message broker producers, consumers and subscribers. The client is safe for concurrent use and supports asynchronous startup and disposal.

Inheritance
object
Client
Implements
IClient
IAsyncDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: CodersRealm.NmsAmqpClient
Assembly: CodersRealm.NmsAmqpClient.dll
Syntax
public sealed class Client : IClient, IAsyncDisposable

Constructors

Client(string)

Initializes a new instance of the Client class using the specified connection string and optional logger.

Declaration
public Client(string connectionString)
Parameters
Type Name Description
string connectionString

The connection string used to establish a connection to the message queue. Cannot be null or whitespace.

Client(string, IRedeliveryPolicy?, ILogger<Client>?)

Initializes a new instance of the Client class using the specified connection string and optional logger.

Declaration
public Client(string connectionString, IRedeliveryPolicy? redeliveryPolicy = null, ILogger<Client>? logger = null)
Parameters
Type Name Description
string connectionString

The connection string used to establish a connection to the message queue. Cannot be null or whitespace.

IRedeliveryPolicy redeliveryPolicy

The optional redelivery policy for message redelivery behavior.

ILogger<Client> logger

An optional logger instance for displaying diagnostic information.

Properties

ClientId

Gets the unique identifier for this client instance.

Declaration
public string ClientId { get; }
Property Value
Type Description
string

Consumers

Gets the manager responsible for creating and managing message consumers for queues.

Declaration
public IConsumerManager Consumers { get; }
Property Value
Type Description
IConsumerManager
See Also
IConsumerManager

IsConnected

Gets a bool value indicating whether the client currently has a active connection that has started and is open.

Declaration
public bool IsConnected { get; }
Property Value
Type Description
bool
Remarks

Note, it is possible for the connection to be lost and this flag to indicate true (or vise versa) until internal events are trigger that would enable the determination that the connection is closed or open.

IsDisposed

Gets a value indicating whether the client has been disposed.

Declaration
public bool IsDisposed { get; }
Property Value
Type Description
bool

IsStarted

Gets a value indicating whether the client has been started.

Declaration
public bool IsStarted { get; }
Property Value
Type Description
bool

Producers

Gets the manager responsible for creating and managing message producers.

Declaration
public IProducerManager Producers { get; }
Property Value
Type Description
IProducerManager
See Also
IProducerManager

Subscribers

Gets the manager responsible for creating and managing message subscribers for topics.

Declaration
public ISubscriberManager Subscribers { get; }
Property Value
Type Description
ISubscriberManager
See Also
ISubscriberManager

Methods

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

Declaration
public ValueTask DisposeAsync()
Returns
Type Description
ValueTask

A task that represents the asynchronous dispose operation.

StartAsync()

Starts the client's connection asynchronously.

Declaration
public Task StartAsync()
Returns
Type Description
Task

A Task that completes when the connection has been established.

StartAsync(CancellationToken)

Starts the client's connection asynchronously and observes the provided cancellation token.

Declaration
public Task StartAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken

A token to observe while starting the connection.

Returns
Type Description
Task

A Task that completes when the connection has been established or the operation is cancelled.

Implements

IClient
IAsyncDisposable
In this article
Back to top Generated by DocFX