Table of Contents

Class ServiceBusConnection

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

Connection object to service bus namespace

public class ServiceBusConnection
Inheritance
ServiceBusConnection
Inherited Members

Constructors

ServiceBusConnection(ServiceBusConnectionStringBuilder)

Creates a new connection to service bus.

public ServiceBusConnection(ServiceBusConnectionStringBuilder connectionStringBuilder)

Parameters

connectionStringBuilder ServiceBusConnectionStringBuilder

ServiceBusConnectionStringBuilder having namespace information.

Remarks

It is the responsibility of the user to close the connection after use through CloseAsync()

ServiceBusConnection(string)

Creates a new connection to service bus.

public ServiceBusConnection(string namespaceConnectionString)

Parameters

namespaceConnectionString string

Namespace connection string

Remarks

It is the responsibility of the user to close the connection after use through CloseAsync()

ServiceBusConnection(string, TransportType, RetryPolicy)

Creates a new connection to service bus.

public ServiceBusConnection(string endpoint, TransportType transportType, RetryPolicy retryPolicy = null)

Parameters

endpoint string

Fully qualified domain name for Service Bus. Most likely, {yournamespace}.servicebus.windows.net

transportType TransportType

Transport type.

retryPolicy RetryPolicy

Retry policy for operations. Defaults to Default

ServiceBusConnection(string, TimeSpan, RetryPolicy)

Creates a new connection to service bus.

public ServiceBusConnection(string namespaceConnectionString, TimeSpan operationTimeout, RetryPolicy retryPolicy = null)

Parameters

namespaceConnectionString string

Namespace connection string.

operationTimeout TimeSpan

Duration after which individual operations will timeout.

retryPolicy RetryPolicy

Retry policy for operations. Defaults to Default

Remarks

It is the responsibility of the user to close the connection after use through CloseAsync()

Properties

Endpoint

Fully qualified domain name for Service Bus.

public Uri Endpoint { get; set; }

Property Value

Uri

OperationTimeout

OperationTimeout is applied in erroneous situations to notify the caller about the relevant ServiceBusException

public TimeSpan OperationTimeout { get; set; }

Property Value

TimeSpan

Remarks

Defaults to 1 minute.

RetryPolicy

Retry policy for operations performed on the connection.

public RetryPolicy RetryPolicy { get; set; }

Property Value

RetryPolicy

Remarks

Defaults to Default

TokenProvider

Token provider for authentication. TokenProvider

public ITokenProvider TokenProvider { get; set; }

Property Value

ITokenProvider

TransportType

Get the transport type from the connection string. Available options: Amqp and AmqpWebSockets.

public TransportType TransportType { get; set; }

Property Value

TransportType

Methods

CloseAsync()

Closes the connection.

public Task CloseAsync()

Returns

Task