ServiceBusClient Constructors

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

ServiceBusClient()

Source:
ServiceBusClient.cs
Source:
ServiceBusClient.cs

Can be used for mocking.

C#
protected ServiceBusClient();

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview

ServiceBusClient(String)

Source:
ServiceBusClient.cs
Source:
ServiceBusClient.cs

Initializes a new instance of the ServiceBusClient class.

C#
public ServiceBusClient(string connectionString);

Parameters

connectionString
String

The connection string to use for connecting to the Service Bus namespace.

Remarks

If the connection string specifies a specific entity name, any subsequent calls to CreateSender(String), CreateReceiver(String), CreateProcessor(String) etc. must still specify the same entity name.

The connection string will recognize and apply properties populated by the Azure portal such as Endpoint, SharedAccessKeyName, SharedAccessKey, and EntityPath. Other values will be ignored; to configure the processor, please use the ServiceBusClientOptions.

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview

ServiceBusClient(String, TokenCredential)

Source:
ServiceBusClient.cs
Source:
ServiceBusClient.cs

Initializes a new instance of the ServiceBusClient class.

C#
public ServiceBusClient(string fullyQualifiedNamespace, Azure.Core.TokenCredential credential);

Parameters

fullyQualifiedNamespace
String

The fully qualified Service Bus namespace to connect to. This is likely to be similar to {yournamespace}.servicebus.windows.net.

credential
TokenCredential

The Azure managed identity credential to use for authorization. Access controls may be specified by the Service Bus namespace.

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview

ServiceBusClient(String, ServiceBusClientOptions)

Source:
ServiceBusClient.cs
Source:
ServiceBusClient.cs

Initializes a new instance of the ServiceBusClient class.

C#
public ServiceBusClient(string connectionString, Azure.Messaging.ServiceBus.ServiceBusClientOptions options);

Parameters

connectionString
String

The connection string to use for connecting to the Service Bus namespace.

options
ServiceBusClientOptions

The set of ServiceBusClientOptions to use for configuring this ServiceBusClient.

Remarks

If the connection string specifies a specific entity name, any subsequent calls to CreateSender(String), CreateReceiver(String), CreateProcessor(String) etc. must still specify the same entity name.

The connection string will recognize and apply properties populated by the Azure portal such as Endpoint, SharedAccessKeyName, SharedAccessKey, and EntityPath. Other values will be ignored; to configure the processor, please use the ServiceBusClientOptions.

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview

ServiceBusClient(String, AzureNamedKeyCredential, ServiceBusClientOptions)

Source:
ServiceBusClient.cs
Source:
ServiceBusClient.cs

Initializes a new instance of the ServiceBusClient class.

C#
public ServiceBusClient(string fullyQualifiedNamespace, Azure.AzureNamedKeyCredential credential, Azure.Messaging.ServiceBus.ServiceBusClientOptions options = default);

Parameters

fullyQualifiedNamespace
String

The fully qualified Service Bus namespace to connect to. This is likely to be similar to {yournamespace}.servicebus.windows.net.

credential
AzureNamedKeyCredential

The AzureNamedKeyCredential to use for authorization. Access controls may be specified by the Service Bus namespace.

options
ServiceBusClientOptions

The set of ServiceBusClientOptions to use for configuring this ServiceBusClient.

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview

ServiceBusClient(String, AzureSasCredential, ServiceBusClientOptions)

Source:
ServiceBusClient.cs
Source:
ServiceBusClient.cs

Initializes a new instance of the ServiceBusClient class.

C#
public ServiceBusClient(string fullyQualifiedNamespace, Azure.AzureSasCredential credential, Azure.Messaging.ServiceBus.ServiceBusClientOptions options = default);

Parameters

fullyQualifiedNamespace
String

The fully qualified Service Bus namespace to connect to. This is likely to be similar to {yournamespace}.servicebus.windows.net.

credential
AzureSasCredential

The AzureSasCredential to use for authorization. Access controls may be specified by the Service Bus namespace.

options
ServiceBusClientOptions

The set of ServiceBusClientOptions to use for configuring this ServiceBusClient.

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview

ServiceBusClient(String, TokenCredential, ServiceBusClientOptions)

Source:
ServiceBusClient.cs
Source:
ServiceBusClient.cs

Initializes a new instance of the ServiceBusClient class.

C#
public ServiceBusClient(string fullyQualifiedNamespace, Azure.Core.TokenCredential credential, Azure.Messaging.ServiceBus.ServiceBusClientOptions options);

Parameters

fullyQualifiedNamespace
String

The fully qualified Service Bus namespace to connect to. This is likely to be similar to {yournamespace}.servicebus.windows.net.

credential
TokenCredential

The Azure managed identity credential to use for authorization. Access controls may be specified by the Service Bus namespace.

options
ServiceBusClientOptions

The set of ServiceBusClientOptions to use for configuring this ServiceBusClient.

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview