public final class ServiceBusConnectionStringProperties extends Object
"Endpoint=sb://foo.servicebus.windows.net/;SharedAccessKeyName=someKeyName;SharedAccessKey=someKeyValue"
.
A connection may have the following sections:
When you have a ServiceBus connection string, you can use ServiceBusClientBuilder.connectionString(String)
to build a client. If you'd like to use a TokenCredential
to access a Service Bus, you can use this utility
class to take the fully qualified namespace and optionally the entity path (queue/topic name) from the connection
string and then use ServiceBusClientBuilder.credential(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.
|
String |
getSharedAccessSignature()
Gets the "SharedAccessSignature" section of the connection string.
|
static ServiceBusConnectionStringProperties |
parse(String connectionString)
Parse a Service Bus connection string into an instance of this class.
|
public static ServiceBusConnectionStringProperties 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".public String getSharedAccessSignature()
null
if the connection string doesn't have a
"SharedAccessSignature".Copyright © 2021 Microsoft Corporation. All rights reserved.