ServiceBusConnectionStringProperties Class
- java.
lang. Object - com.
azure. messaging. servicebus. ServiceBusConnectionStringProperties
- com.
public final class ServiceBusConnectionStringProperties
A utility class that parses a connection string into sections. A Service Bus connection string is a set of key value pairs separated by semi-colon. A typical example is "Endpoint=sb://foo.servicebus.windows.net/;SharedAccessKeyName=someKeyName;SharedAccessKey=someKeyValue"
.
A connection may have the following sections:
- Endpoint, which is mandatory. The hostname part of it is the "Fully qualified namespace".
- SharedAccessKeyName and SharedAccessKey, optional, used to authenticate the access to the ServiceBus.
- SharedAccessSignature, optional, an alternative way to authenticate the access to the ServiceBus.
- EntityPath, optional, the queue name or the topic name under the service namespace
When you have a ServiceBus connection string, you can use connectionString(String connectionString) 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 credential(String fullyQualifiedNamespace, TokenCredential credential).
Method Summary
Modifier and Type | Method and Description |
---|---|
String |
getEndpoint()
Gets the "Endpoint" value of the connection string. |
String |
getEntityPath()
Gets the "Entity |
String |
getFullyQualifiedNamespace()
Gets the fully qualified namespace, or hostname, from the connection string "Endpoint" section. |
String |
getSharedAccessKey()
Gets the "Shared |
String |
getSharedAccessKeyName()
Gets the "Shared |
String |
getSharedAccessSignature()
Gets the "Shared |
static
Service |
parse(String connectionString)
Parse a Service Bus connection string into an instance of this class. |
Methods inherited from java.lang.Object
Method Details
getEndpoint
public String getEndpoint()
Gets the "Endpoint" value of the connection string.
Returns:
getEntityPath
public String getEntityPath()
Gets the "EntityPath" value of the connection string.
Returns:
null
if the connection string doesn't have an "EntityPath".getFullyQualifiedNamespace
public String getFullyQualifiedNamespace()
Gets the fully qualified namespace, or hostname, from the connection string "Endpoint" section.
Returns:
getSharedAccessKey
public String getSharedAccessKey()
Gets the "SharedAccessSignature" section of the connection string.
Returns:
null
if the connection string doesn't have a
"SharedAccessSignature".getSharedAccessKeyName
public String getSharedAccessKeyName()
Gets the "SharedAccessKeyName" section of the connection string.
Returns:
null
if the connection string doesn't have a
"SharedAccessKeyName".getSharedAccessSignature
public String getSharedAccessSignature()
Gets the "SharedAccessSignature" section of the connection string.
Returns:
null
if the connection string doesn't have a
"SharedAccessSignature".parse
public static ServiceBusConnectionStringProperties parse(String connectionString)
Parse a Service Bus connection string into an instance of this class.
Parameters:
Returns:
Applies to
Azure SDK for Java
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for