共用方式為


EventHubsConnectionStringBuilder Class

Definition

EventHubsConnectionStringBuilder can be used to construct a connection string which can establish communication with Event Hubs entities. It can also be used to perform basic validation on an existing connection string.

A connection string is basically a string consisted of key-value pair separated by ";". Basic format is "<key>=<value>[;<key>=<value>]" where supported key name are as follow:

Endpoint - the URL that contains the Event Hubs namespace

EntityPath - the path to the Event Hub entity

SharedAccessKeyName - the key name to the corresponding shared access policy rule for the namespace, or entity.

SharedAccessKey - the key for the corresponding shared access policy rule of the namespace or entity.
public class EventHubsConnectionStringBuilder
type EventHubsConnectionStringBuilder = class
Public Class EventHubsConnectionStringBuilder
Inheritance
EventHubsConnectionStringBuilder

Examples

Sample code:

var connectionStringBuiler = new EventHubsConnectionStringBuilder(
    "amqps://EventHubsNamespaceName.servicebus.windows.net", 
    "EventHubsEntityName", // Event Hub Name 
    "SharedAccessSignatureKeyName", 
    "SharedAccessSignatureKey");
 string connectionString = connectionStringBuiler.ToString();

Constructors

EventHubsConnectionStringBuilder(String)

ConnectionString format: Endpoint=sb://namespace_DNS_Name;EntityPath=EVENT_HUB_NAME;SharedAccessKeyName=SHARED_ACCESS_KEY_NAME;SharedAccessKey=SHARED_ACCESS_KEY

EventHubsConnectionStringBuilder(Uri, String, String, String, TimeSpan)

Build a connection string consumable by CreateFromConnectionString(String)

EventHubsConnectionStringBuilder(Uri, String, String, String)

Build a connection string consumable by CreateFromConnectionString(String)

EventHubsConnectionStringBuilder(Uri, String, String, TimeSpan)

Build a connection string consumable by CreateFromConnectionString(String)

Properties

Authentication

Enables Azure Active Directory Managed Identity authentication when set to 'Managed Identity'

Endpoint

Gets or sets the Event Hubs endpoint.

EntityPath

Get the entity path value from the connection string

OperationTimeout

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

SasKey

Get the shared access policy key value from the connection string

SasKeyName

Get the shared access policy owner name from the connection string

SharedAccessSignature

Gets or sets the SAS access token.

TransportType

Transport type for the client connection. Avaiable options are Amqp and AmqpWebSockets. Defaults to Amqp if not specified.

Methods

Clone()

Creates a cloned object of the current EventHubsConnectionStringBuilder.

ToString()

Returns an interoperable connection string that can be used to connect to Event Hubs Namespace

Applies to