public final class EventHubConnectionStringProperties extends Object
"Endpoint=sb://foo.EventHub.windows.net/;SharedAccessKeyName=someKeyName;SharedAccessKey=someKeyValue".
A connection may have the following sections:
When you have an Event Hubs connection string, you can use EventHubClientBuilder.connectionString(String)
to build a client. If you'd like to use a TokenCredential to access an Event Hub, you can use this utility
class to get the fully qualified namespace and entity path from the connection
string and then use EventHubClientBuilder.credential(String, String, TokenCredential).
| Modifier and Type | Method and Description |
|---|---|
String |
getEndpoint()
Gets the "Endpoint" value of the connection string.
|
String |
getEntityPath()
Gets the "EntityPath" value of the connection string.
|
String |
getFullyQualifiedNamespace()
Gets the fully qualified namespace, or hostname, from the connection string "Endpoint" section.
|
String |
getSharedAccessKey()
Gets the "SharedAccessSignature" section of the connection string.
|
String |
getSharedAccessKeyName()
Gets the "SharedAccessKeyName" section of the connection string.
|
static EventHubConnectionStringProperties |
parse(String connectionString)
Parse a Event Hub connection string into an instance of this class.
|
public static EventHubConnectionStringProperties parse(String connectionString)
connectionString - The connection string to be parsed.NullPointerException - if connectionString is null.IllegalArgumentException - if the connectionString is empty or malformed.public String getEntityPath()
null if the connection string doesn't have an "EntityPath".public String getEndpoint()
public String getFullyQualifiedNamespace()
public String getSharedAccessKeyName()
null if the connection string doesn't have a
"SharedAccessKeyName".public String getSharedAccessKey()
null if the connection string doesn't have a
"SharedAccessSignature".Copyright © 2021 Microsoft Corporation. All rights reserved.