共用方式為


EventHubProducerClient Constructors

Definition

Overloads

EventHubProducerClient()

Initializes a new instance of the EventHubProducerClient class.

EventHubProducerClient(String)

Initializes a new instance of the EventHubProducerClient class.

EventHubProducerClient(EventHubConnection, EventHubProducerClientOptions)

Initializes a new instance of the EventHubProducerClient class.

EventHubProducerClient(String, EventHubProducerClientOptions)

Initializes a new instance of the EventHubProducerClient class.

EventHubProducerClient(String, String)

Initializes a new instance of the EventHubProducerClient class.

EventHubProducerClient(String, String, EventHubProducerClientOptions)

Initializes a new instance of the EventHubProducerClient class.

EventHubProducerClient(String, String, AzureNamedKeyCredential, EventHubProducerClientOptions)

Initializes a new instance of the EventHubProducerClient class.

EventHubProducerClient(String, String, AzureSasCredential, EventHubProducerClientOptions)

Initializes a new instance of the EventHubProducerClient class.

EventHubProducerClient(String, String, TokenCredential, EventHubProducerClientOptions)

Initializes a new instance of the EventHubProducerClient class.

EventHubProducerClient()

Source:
EventHubProducerClient.cs
Source:
EventHubProducerClient.cs

Initializes a new instance of the EventHubProducerClient class.

protected EventHubProducerClient ();
Protected Sub New ()

Applies to

EventHubProducerClient(String)

Source:
EventHubProducerClient.cs
Source:
EventHubProducerClient.cs

Initializes a new instance of the EventHubProducerClient class.

public EventHubProducerClient (string connectionString);
new Azure.Messaging.EventHubs.Producer.EventHubProducerClient : string -> Azure.Messaging.EventHubs.Producer.EventHubProducerClient
Public Sub New (connectionString As String)

Parameters

connectionString
String

The connection string to use for connecting to the Event Hubs namespace; it is expected that the Event Hub name and the shared key properties are contained in this connection string.

Remarks

If the connection string is copied from the Event Hubs namespace, it will likely not contain the name of the desired Event Hub, which is needed. In this case, the name can be added manually by adding ";EntityPath=[[ EVENT HUB NAME ]]" to the end of the connection string. For example, ";EntityPath=telemetry-hub".

If you have defined a shared access policy directly on the Event Hub itself, then copying the connection string from that Event Hub will result in a connection string that contains the name.

Applies to

EventHubProducerClient(EventHubConnection, EventHubProducerClientOptions)

Source:
EventHubProducerClient.cs
Source:
EventHubProducerClient.cs

Initializes a new instance of the EventHubProducerClient class.

public EventHubProducerClient (Azure.Messaging.EventHubs.EventHubConnection connection, Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions clientOptions = default);
new Azure.Messaging.EventHubs.Producer.EventHubProducerClient : Azure.Messaging.EventHubs.EventHubConnection * Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions -> Azure.Messaging.EventHubs.Producer.EventHubProducerClient
Public Sub New (connection As EventHubConnection, Optional clientOptions As EventHubProducerClientOptions = Nothing)

Parameters

connection
EventHubConnection

The EventHubConnection connection to use for communication with the Event Hubs service.

clientOptions
EventHubProducerClientOptions

A set of options to apply when configuring the producer.

Applies to

EventHubProducerClient(String, EventHubProducerClientOptions)

Source:
EventHubProducerClient.cs
Source:
EventHubProducerClient.cs

Initializes a new instance of the EventHubProducerClient class.

public EventHubProducerClient (string connectionString, Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions clientOptions);
new Azure.Messaging.EventHubs.Producer.EventHubProducerClient : string * Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions -> Azure.Messaging.EventHubs.Producer.EventHubProducerClient
Public Sub New (connectionString As String, clientOptions As EventHubProducerClientOptions)

Parameters

connectionString
String

The connection string to use for connecting to the Event Hubs namespace; it is expected that the Event Hub name and the shared key properties are contained in this connection string.

clientOptions
EventHubProducerClientOptions

The set of options to use for this consumer.

Remarks

If the connection string is copied from the Event Hubs namespace, it will likely not contain the name of the desired Event Hub, which is needed. In this case, the name can be added manually by adding ";EntityPath=[[ EVENT HUB NAME ]]" to the end of the connection string. For example, ";EntityPath=telemetry-hub".

If you have defined a shared access policy directly on the Event Hub itself, then copying the connection string from that Event Hub will result in a connection string that contains the name.

Applies to

EventHubProducerClient(String, String)

Source:
EventHubProducerClient.cs
Source:
EventHubProducerClient.cs

Initializes a new instance of the EventHubProducerClient class.

public EventHubProducerClient (string connectionString, string eventHubName);
new Azure.Messaging.EventHubs.Producer.EventHubProducerClient : string * string -> Azure.Messaging.EventHubs.Producer.EventHubProducerClient
Public Sub New (connectionString As String, eventHubName As String)

Parameters

connectionString
String

The connection string to use for connecting to the Event Hubs namespace; it is expected that the shared key properties are contained in this connection string, but not the Event Hub name.

eventHubName
String

The name of the specific Event Hub to associate the producer with.

Remarks

If the connection string is copied from the Event Hub itself, it will contain the name of the desired Event Hub, and can be used directly without passing the eventHubName. The name of the Event Hub should be passed only once, either as part of the connection string or separately.

Applies to

EventHubProducerClient(String, String, EventHubProducerClientOptions)

Source:
EventHubProducerClient.cs
Source:
EventHubProducerClient.cs

Initializes a new instance of the EventHubProducerClient class.

public EventHubProducerClient (string connectionString, string eventHubName, Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions clientOptions);
new Azure.Messaging.EventHubs.Producer.EventHubProducerClient : string * string * Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions -> Azure.Messaging.EventHubs.Producer.EventHubProducerClient
Public Sub New (connectionString As String, eventHubName As String, clientOptions As EventHubProducerClientOptions)

Parameters

connectionString
String

The connection string to use for connecting to the Event Hubs namespace; it is expected that the shared key properties are contained in this connection string, but not the Event Hub name.

eventHubName
String

The name of the specific Event Hub to associate the producer with.

clientOptions
EventHubProducerClientOptions

A set of options to apply when configuring the producer.

Remarks

If the connection string is copied from the Event Hub itself, it will contain the name of the desired Event Hub, and can be used directly without passing the eventHubName. The name of the Event Hub should be passed only once, either as part of the connection string or separately.

Applies to

EventHubProducerClient(String, String, AzureNamedKeyCredential, EventHubProducerClientOptions)

Source:
EventHubProducerClient.cs
Source:
EventHubProducerClient.cs

Initializes a new instance of the EventHubProducerClient class.

public EventHubProducerClient (string fullyQualifiedNamespace, string eventHubName, Azure.AzureNamedKeyCredential credential, Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions clientOptions = default);
new Azure.Messaging.EventHubs.Producer.EventHubProducerClient : string * string * Azure.AzureNamedKeyCredential * Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions -> Azure.Messaging.EventHubs.Producer.EventHubProducerClient
Public Sub New (fullyQualifiedNamespace As String, eventHubName As String, credential As AzureNamedKeyCredential, Optional clientOptions As EventHubProducerClientOptions = Nothing)

Parameters

fullyQualifiedNamespace
String

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

eventHubName
String

The name of the specific Event Hub to associate the producer with.

credential
AzureNamedKeyCredential

The shared access key credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.

clientOptions
EventHubProducerClientOptions

A set of options to apply when configuring the producer.

Applies to

EventHubProducerClient(String, String, AzureSasCredential, EventHubProducerClientOptions)

Source:
EventHubProducerClient.cs
Source:
EventHubProducerClient.cs

Initializes a new instance of the EventHubProducerClient class.

public EventHubProducerClient (string fullyQualifiedNamespace, string eventHubName, Azure.AzureSasCredential credential, Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions clientOptions = default);
new Azure.Messaging.EventHubs.Producer.EventHubProducerClient : string * string * Azure.AzureSasCredential * Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions -> Azure.Messaging.EventHubs.Producer.EventHubProducerClient
Public Sub New (fullyQualifiedNamespace As String, eventHubName As String, credential As AzureSasCredential, Optional clientOptions As EventHubProducerClientOptions = Nothing)

Parameters

fullyQualifiedNamespace
String

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

eventHubName
String

The name of the specific Event Hub to associate the producer with.

credential
AzureSasCredential

The shared access signature credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.

clientOptions
EventHubProducerClientOptions

A set of options to apply when configuring the producer.

Applies to

EventHubProducerClient(String, String, TokenCredential, EventHubProducerClientOptions)

Source:
EventHubProducerClient.cs
Source:
EventHubProducerClient.cs

Initializes a new instance of the EventHubProducerClient class.

public EventHubProducerClient (string fullyQualifiedNamespace, string eventHubName, Azure.Core.TokenCredential credential, Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions clientOptions = default);
new Azure.Messaging.EventHubs.Producer.EventHubProducerClient : string * string * Azure.Core.TokenCredential * Azure.Messaging.EventHubs.Producer.EventHubProducerClientOptions -> Azure.Messaging.EventHubs.Producer.EventHubProducerClient
Public Sub New (fullyQualifiedNamespace As String, eventHubName As String, credential As TokenCredential, Optional clientOptions As EventHubProducerClientOptions = Nothing)

Parameters

fullyQualifiedNamespace
String

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

eventHubName
String

The name of the specific Event Hub to associate the producer with.

credential
TokenCredential

The Azure managed identity credential to use for authorization. Access controls may be specified by the Event Hubs namespace or the requested Event Hub, depending on Azure configuration.

clientOptions
EventHubProducerClientOptions

A set of options to apply when configuring the producer.

Applies to