Table of Contents

Class ClientEntity

Namespace
Microsoft.Azure.ServiceBus
Assembly
Microsoft.Azure.ServiceBus.dll

Contract for all client entities with Open-Close/Abort state m/c main-purpose: closeAll related entities

public abstract class ClientEntity : IClientEntity
Inheritance
ClientEntity
Implements
Derived
Inherited Members

Constructors

ClientEntity(string, string, RetryPolicy)

protected ClientEntity(string clientTypeName, string postfix, RetryPolicy retryPolicy)

Parameters

clientTypeName string
postfix string
retryPolicy RetryPolicy

Properties

ClientId

Gets the ID to identify this client. This can be used to correlate logs and exceptions.

public string ClientId { get; }

Property Value

string

Remarks

Every new client has a unique ID (in that process).

IsClosedOrClosing

Returns true if the client is closed or closing.

public bool IsClosedOrClosing { get; }

Property Value

bool

OperationTimeout

Duration after which individual operations will timeout.

public abstract TimeSpan OperationTimeout { get; set; }

Property Value

TimeSpan

Path

Gets the name of the entity.

public abstract string Path { get; }

Property Value

string

RegisteredPlugins

Gets a list of currently registered plugins for this client.

public abstract IList<ServiceBusPlugin> RegisteredPlugins { get; }

Property Value

IList<ServiceBusPlugin>

RetryPolicy

Gets the RetryPolicy defined on the client.

public RetryPolicy RetryPolicy { get; }

Property Value

RetryPolicy

ServiceBusConnection

Connection object to the service bus namespace.

public abstract ServiceBusConnection ServiceBusConnection { get; }

Property Value

ServiceBusConnection

Methods

CloseAsync()

Closes the Client. Closes the connections opened by it.

public Task CloseAsync()

Returns

Task

GenerateClientId(string, string)

Generates a new client id that can be used to identify a specific client in logs and error messages.

protected static string GenerateClientId(string clientTypeName, string postfix = "")

Parameters

clientTypeName string
postfix string

Information that can be appended by the client.

Returns

string

GetNextId()

protected static long GetNextId()

Returns

long

OnClosingAsync()

protected abstract Task OnClosingAsync()

Returns

Task

RegisterPlugin(ServiceBusPlugin)

Registers a ServiceBusPlugin to be used with this client.

public abstract void RegisterPlugin(ServiceBusPlugin serviceBusPlugin)

Parameters

serviceBusPlugin ServiceBusPlugin

The ServiceBusPlugin to register.

ThrowIfClosed()

Throw an OperationCanceledException if the object is Closing.

protected virtual void ThrowIfClosed()

UnregisterPlugin(string)

Unregisters a ServiceBusPlugin.

public abstract void UnregisterPlugin(string serviceBusPluginName)

Parameters

serviceBusPluginName string

The name Name to be unregistered