Class ManagementClientAsync
- java.lang.Object
-
- com.microsoft.azure.servicebus.management.ManagementClientAsync
-
public class ManagementClientAsync extends Object
Asynchronous client to perform management operations on Service Bus entities. Operations return CompletableFuture which asynchronously return the responses.
-
-
Constructor Summary
Constructors Constructor Description ManagementClientAsync(ConnectionStringBuilder connectionStringBuilder)
Creates a newManagementClientAsync
.ManagementClientAsync(URI namespaceEndpointURI, ClientSettings clientSettings)
Creates a newManagementClientAsync
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Disposes and closes the managementClient.CompletableFuture<QueueDescription>
createQueueAsync(QueueDescription queueDescription)
Creates a new queue in the service namespace with the given name.CompletableFuture<QueueDescription>
createQueueAsync(String queuePath)
Creates a new queue in the service namespace with the given name.CompletableFuture<RuleDescription>
createRuleAsync(String topicName, String subscriptionName, RuleDescription ruleDescription)
Creates a new rule for a given topic - subscription.CompletableFuture<SubscriptionDescription>
createSubscriptionAsync(SubscriptionDescription subscriptionDescription)
Creates a new subscription in the service namespace with the given name.CompletableFuture<SubscriptionDescription>
createSubscriptionAsync(SubscriptionDescription subscriptionDescription, RuleDescription defaultRule)
Creates a new subscription in the service namespace with the provided default rule.CompletableFuture<SubscriptionDescription>
createSubscriptionAsync(String topicPath, String subscriptionName)
Creates a new subscription for a given topic in the service namespace with the given name.CompletableFuture<TopicDescription>
createTopicAsync(TopicDescription topicDescription)
Creates a new topic in the service namespace with the given name.CompletableFuture<TopicDescription>
createTopicAsync(String topicPath)
Creates a new topic in the service namespace with the given name.CompletableFuture<Void>
deleteQueueAsync(String path)
Deletes the queue described by the path relative to the service namespace base address.CompletableFuture<Void>
deleteRuleAsync(String topicPath, String subscriptionName, String ruleName)
Deletes the rule for a given topic-subscription.CompletableFuture<Void>
deleteSubscriptionAsync(String topicPath, String subscriptionName)
Deletes the subscription described by the topicPath and the subscriptionName.CompletableFuture<Void>
deleteTopicAsync(String path)
Deletes the topic described by the path relative to the service namespace base address.CompletableFuture<NamespaceInfo>
getNamespaceInfoAsync()
Retrieves information related to the namespace.CompletableFuture<QueueDescription>
getQueueAsync(String path)
Retrieves a queue from the service namespaceCompletableFuture<QueueRuntimeInfo>
getQueueRuntimeInfoAsync(String path)
Retrieves the runtime information of a queue.CompletableFuture<List<QueueDescription>>
getQueuesAsync()
Retrieves the list of queues present in the namespace.CompletableFuture<List<QueueDescription>>
getQueuesAsync(int count, int skip)
Retrieves the list of queues present in the namespace.CompletableFuture<RuleDescription>
getRuleAsync(String topicPath, String subscriptionName, String ruleName)
Retrieves a rule for a given topic and subscription from the service namespaceCompletableFuture<List<RuleDescription>>
getRulesAsync(String topicName, String subscriptionName)
Retrieves the list of rules for a given topic-subscription in the namespace.CompletableFuture<List<RuleDescription>>
getRulesAsync(String topicName, String subscriptionName, int count, int skip)
Retrieves the list of rules for a given topic-subscription in the namespace.CompletableFuture<SubscriptionDescription>
getSubscriptionAsync(String topicPath, String subscriptionName)
Retrieves a subscription for a given topic from the service namespaceCompletableFuture<SubscriptionRuntimeInfo>
getSubscriptionRuntimeInfoAsync(String topicPath, String subscriptionName)
Retrieves the runtime information of a subscription in a given topicCompletableFuture<List<SubscriptionDescription>>
getSubscriptionsAsync(String topicName)
Retrieves the list of subscriptions for a given topic in the namespace.CompletableFuture<List<SubscriptionDescription>>
getSubscriptionsAsync(String topicName, int count, int skip)
Retrieves the list of subscriptions for a given topic in the namespace.CompletableFuture<TopicDescription>
getTopicAsync(String path)
Retrieves a topic from the service namespaceCompletableFuture<TopicRuntimeInfo>
getTopicRuntimeInfoAsync(String path)
Retrieves the runtime information of a topicCompletableFuture<List<TopicDescription>>
getTopicsAsync()
Retrieves the list of topics present in the namespace.CompletableFuture<List<TopicDescription>>
getTopicsAsync(int count, int skip)
Retrieves the list of topics present in the namespace.CompletableFuture<Boolean>
queueExistsAsync(String path)
Checks whether a given queue exists or not.CompletableFuture<Boolean>
ruleExistsAsync(String topicPath, String subscriptionName, String ruleName)
Checks whether a given rule exists or not for a given subscription.CompletableFuture<Boolean>
subscriptionExistsAsync(String topicPath, String subscriptionName)
Checks whether a given subscription exists or not.CompletableFuture<Boolean>
topicExistsAsync(String path)
Checks whether a given topic exists or not.CompletableFuture<QueueDescription>
updateQueueAsync(QueueDescription queueDescription)
Updates an existing queue.CompletableFuture<RuleDescription>
updateRuleAsync(String topicName, String subscriptionName, RuleDescription ruleDescription)
Updates an existing rule.CompletableFuture<SubscriptionDescription>
updateSubscriptionAsync(SubscriptionDescription subscriptionDescription)
Updates an existing subscription.CompletableFuture<TopicDescription>
updateTopicAsync(TopicDescription topicDescription)
Updates an existing topic.
-
-
-
Constructor Detail
-
ManagementClientAsync
public ManagementClientAsync(ConnectionStringBuilder connectionStringBuilder)
Creates a newManagementClientAsync
. User should callclose()
at the end of life of the client.- Parameters:
connectionStringBuilder
- - connectionStringBuilder containing namespace information and client settings.
-
ManagementClientAsync
public ManagementClientAsync(URI namespaceEndpointURI, ClientSettings clientSettings)
Creates a newManagementClientAsync
. User should callclose()
at the end of life of the client.- Parameters:
namespaceEndpointURI
- - URI of the namespace connecting to.clientSettings
- - client settings.
-
-
Method Detail
-
getNamespaceInfoAsync
public CompletableFuture<NamespaceInfo> getNamespaceInfoAsync()
Retrieves information related to the namespace. Works with any claim (Send/Listen/Manage).- Returns:
- -
NamespaceInfo
containing namespace information.
-
getQueueAsync
public CompletableFuture<QueueDescription> getQueueAsync(String path)
Retrieves a queue from the service namespace- Parameters:
path
- - The path of the queue relative to service bus namespace.- Returns:
- - QueueDescription containing information about the queue.
- Throws:
IllegalArgumentException
- - Thrown if path is null, empty, or not in right format or length.
-
getQueueRuntimeInfoAsync
public CompletableFuture<QueueRuntimeInfo> getQueueRuntimeInfoAsync(String path)
Retrieves the runtime information of a queue.- Parameters:
path
- - The path of the queue relative to service bus namespace.- Returns:
- - QueueRuntimeInfo containing runtime information about the queue.
- Throws:
IllegalArgumentException
- - Thrown if path is null, empty, or not in right format or length.
-
getTopicAsync
public CompletableFuture<TopicDescription> getTopicAsync(String path)
Retrieves a topic from the service namespace- Parameters:
path
- - The path of the queue relative to service bus namespace.- Returns:
- - Description containing information about the topic.
- Throws:
IllegalArgumentException
- - Thrown if path is null, empty, or not in right format or length.
-
getTopicRuntimeInfoAsync
public CompletableFuture<TopicRuntimeInfo> getTopicRuntimeInfoAsync(String path)
Retrieves the runtime information of a topic- Parameters:
path
- - The path of the queue relative to service bus namespace.- Returns:
- - TopicRuntimeInfo containing runtime information about the topic.
- Throws:
IllegalArgumentException
- - Thrown if path is null, empty, or not in right format or length.
-
getSubscriptionAsync
public CompletableFuture<SubscriptionDescription> getSubscriptionAsync(String topicPath, String subscriptionName)
Retrieves a subscription for a given topic from the service namespace- Parameters:
topicPath
- - The path of the topic relative to service bus namespace.subscriptionName
- - The name of the subscription- Returns:
- - SubscriptionDescription containing information about the subscription.
- Throws:
IllegalArgumentException
- - Thrown if path is null, empty, or not in right format or length.
-
getSubscriptionRuntimeInfoAsync
public CompletableFuture<SubscriptionRuntimeInfo> getSubscriptionRuntimeInfoAsync(String topicPath, String subscriptionName)
Retrieves the runtime information of a subscription in a given topic- Parameters:
topicPath
- - The path of the topic relative to service bus namespace.subscriptionName
- - The name of the subscription- Returns:
- - SubscriptionRuntimeInfo containing the runtime information about the subscription.
- Throws:
IllegalArgumentException
- - Thrown if path is null, empty, or not in right format or length.
-
getRuleAsync
public CompletableFuture<RuleDescription> getRuleAsync(String topicPath, String subscriptionName, String ruleName)
Retrieves a rule for a given topic and subscription from the service namespace- Parameters:
topicPath
- - The path of the topic relative to service bus namespace.subscriptionName
- - The name of the subscription.ruleName
- - The name of the rule.- Returns:
- - RuleDescription containing information about the subscription.
- Throws:
IllegalArgumentException
- - Thrown if path is null, empty, or not in right format or length.
-
getQueuesAsync
public CompletableFuture<List<QueueDescription>> getQueuesAsync()
Retrieves the list of queues present in the namespace.- Returns:
- the first 100 queues.
-
getQueuesAsync
public CompletableFuture<List<QueueDescription>> getQueuesAsync(int count, int skip)
Retrieves the list of queues present in the namespace. You can simulate pages of list of entities by manipulating count and skip parameters. skip(0)+count(100) gives first 100 entities. skip(100)+count(100) gives the next 100 entities.- Parameters:
count
- - The number of queues to fetch. Defaults to 100. Maximum value allowed is 100.skip
- - The number of queues to skip. Defaults to 0. Cannot be negative.- Returns:
- the list of queues.
-
getTopicsAsync
public CompletableFuture<List<TopicDescription>> getTopicsAsync()
Retrieves the list of topics present in the namespace.- Returns:
- the first 100 topics.
-
getTopicsAsync
public CompletableFuture<List<TopicDescription>> getTopicsAsync(int count, int skip)
Retrieves the list of topics present in the namespace. You can simulate pages of list of entities by manipulating count and skip parameters. skip(0)+count(100) gives first 100 entities. skip(100)+count(100) gives the next 100 entities.- Parameters:
count
- - The number of topics to fetch. Defaults to 100. Maximum value allowed is 100.skip
- - The number of topics to skip. Defaults to 0. Cannot be negative.- Returns:
- the list of topics.
-
getSubscriptionsAsync
public CompletableFuture<List<SubscriptionDescription>> getSubscriptionsAsync(String topicName)
Retrieves the list of subscriptions for a given topic in the namespace.- Parameters:
topicName
- - The name of the topic.- Returns:
- the first 100 subscriptions.
-
getSubscriptionsAsync
public CompletableFuture<List<SubscriptionDescription>> getSubscriptionsAsync(String topicName, int count, int skip)
Retrieves the list of subscriptions for a given topic in the namespace. You can simulate pages of list of entities by manipulating count and skip parameters. skip(0)+count(100) gives first 100 entities. skip(100)+count(100) gives the next 100 entities.- Parameters:
topicName
- - The name of the topic.count
- - The number of subscriptions to fetch. Defaults to 100. Maximum value allowed is 100.skip
- - The number of subscriptions to skip. Defaults to 0. Cannot be negative.- Returns:
- the list of subscriptions.
-
getRulesAsync
public CompletableFuture<List<RuleDescription>> getRulesAsync(String topicName, String subscriptionName)
Retrieves the list of rules for a given topic-subscription in the namespace.- Parameters:
topicName
- - The name of the topic.subscriptionName
- - The name of the subscription.- Returns:
- the first 100 rules.
-
getRulesAsync
public CompletableFuture<List<RuleDescription>> getRulesAsync(String topicName, String subscriptionName, int count, int skip)
Retrieves the list of rules for a given topic-subscription in the namespace. You can simulate pages of list of entities by manipulating count and skip parameters. skip(0)+count(100) gives first 100 entities. skip(100)+count(100) gives the next 100 entities.- Parameters:
topicName
- - The name of the topic.subscriptionName
- - The name of the subscription.count
- - The number of rules to fetch. Defaults to 100. Maximum value allowed is 100.skip
- - The number of rules to skip. Defaults to 0. Cannot be negative.- Returns:
- the list of rules.
-
createQueueAsync
public CompletableFuture<QueueDescription> createQueueAsync(String queuePath)
Creates a new queue in the service namespace with the given name. SeeQueueDescription
for default values of queue properties.- Parameters:
queuePath
- - The name of the queue relative to the service namespace base address.- Returns:
QueueDescription
of the newly created queue.- Throws:
IllegalArgumentException
- - Entity name is null, empty, too long or uses illegal characters.
-
createQueueAsync
public CompletableFuture<QueueDescription> createQueueAsync(QueueDescription queueDescription)
Creates a new queue in the service namespace with the given name. SeeQueueDescription
for default values of queue properties.- Parameters:
queueDescription
- - AQueueDescription
object describing the attributes with which the new queue will be created.- Returns:
QueueDescription
of the newly created queue.
-
updateQueueAsync
public CompletableFuture<QueueDescription> updateQueueAsync(QueueDescription queueDescription)
Updates an existing queue.- Parameters:
queueDescription
- - AQueueDescription
object describing the attributes with which the queue will be updated.- Returns:
QueueDescription
of the updated queue.- Throws:
IllegalArgumentException
- - descriptor is null.
-
createTopicAsync
public CompletableFuture<TopicDescription> createTopicAsync(String topicPath)
Creates a new topic in the service namespace with the given name. SeeTopicDescription
for default values of topic properties.- Parameters:
topicPath
- - The name of the topic relative to the service namespace base address.- Returns:
TopicDescription
of the newly created topic.- Throws:
IllegalArgumentException
- - Entity name is null, empty, too long or uses illegal characters.
-
createTopicAsync
public CompletableFuture<TopicDescription> createTopicAsync(TopicDescription topicDescription)
Creates a new topic in the service namespace with the given name. SeeTopicDescription
for default values of topic properties.- Parameters:
topicDescription
- - AQueueDescription
object describing the attributes with which the new topic will be created.- Returns:
TopicDescription
of the newly created topic.
-
updateTopicAsync
public CompletableFuture<TopicDescription> updateTopicAsync(TopicDescription topicDescription)
Updates an existing topic.- Parameters:
topicDescription
- - ATopicDescription
object describing the attributes with which the topic will be updated.- Returns:
TopicDescription
of the updated topic.- Throws:
IllegalArgumentException
- - descriptor is null.
-
createSubscriptionAsync
public CompletableFuture<SubscriptionDescription> createSubscriptionAsync(String topicPath, String subscriptionName)
Creates a new subscription for a given topic in the service namespace with the given name. SeeSubscriptionDescription
for default values of subscription properties.- Parameters:
topicPath
- - The name of the topic relative to the service namespace base address.subscriptionName
- - The name of the subscription.- Returns:
SubscriptionDescription
of the newly created subscription.- Throws:
IllegalArgumentException
- - Entity name is null, empty, too long or uses illegal characters.
-
createSubscriptionAsync
public CompletableFuture<SubscriptionDescription> createSubscriptionAsync(SubscriptionDescription subscriptionDescription)
Creates a new subscription in the service namespace with the given name. SeeSubscriptionDescription
for default values of subscription properties.- Parameters:
subscriptionDescription
- - ASubscriptionDescription
object describing the attributes with which the new subscription will be created.- Returns:
SubscriptionDescription
of the newly created subscription.
-
createSubscriptionAsync
public CompletableFuture<SubscriptionDescription> createSubscriptionAsync(SubscriptionDescription subscriptionDescription, RuleDescription defaultRule)
Creates a new subscription in the service namespace with the provided default rule. SeeSubscriptionDescription
for default values of subscription properties.- Parameters:
subscriptionDescription
- - ASubscriptionDescription
object describing the attributes with which the new subscription will be created.defaultRule
- - ARuleDescription
object describing the default rule. If null, then pass-through filter will be created.- Returns:
SubscriptionDescription
of the newly created subscription.
-
updateSubscriptionAsync
public CompletableFuture<SubscriptionDescription> updateSubscriptionAsync(SubscriptionDescription subscriptionDescription)
Updates an existing subscription.- Parameters:
subscriptionDescription
- - ASubscriptionDescription
object describing the attributes with which the subscription will be updated.- Returns:
SubscriptionDescription
of the updated subscription.- Throws:
IllegalArgumentException
- - descriptor is null.
-
createRuleAsync
public CompletableFuture<RuleDescription> createRuleAsync(String topicName, String subscriptionName, RuleDescription ruleDescription)
Creates a new rule for a given topic - subscription. SeeRuleDescription
for default values of subscription properties.- Parameters:
topicName
- - Name of the topic.subscriptionName
- - Name of the subscription.ruleDescription
- - ARuleDescription
object describing the attributes with which the new rule will be created.- Returns:
RuleDescription
of the newly created rule.
-
updateRuleAsync
public CompletableFuture<RuleDescription> updateRuleAsync(String topicName, String subscriptionName, RuleDescription ruleDescription)
Updates an existing rule.- Parameters:
topicName
- - Name of the topic.subscriptionName
- - Name of the subscription.ruleDescription
- - ARuleDescription
object describing the attributes with which the rule will be updated.- Returns:
RuleDescription
of the updated rule.- Throws:
IllegalArgumentException
- - descriptor is null.
-
queueExistsAsync
public CompletableFuture<Boolean> queueExistsAsync(String path)
Checks whether a given queue exists or not.- Parameters:
path
- - Path of the entity to check- Returns:
- - True if the entity exists. False otherwise.
- Throws:
IllegalArgumentException
- - path is not null / empty / too long / invalid.
-
topicExistsAsync
public CompletableFuture<Boolean> topicExistsAsync(String path)
Checks whether a given topic exists or not.- Parameters:
path
- - Path of the entity to check- Returns:
- - True if the entity exists. False otherwise.
- Throws:
IllegalArgumentException
- - path is not null / empty / too long / invalid.
-
subscriptionExistsAsync
public CompletableFuture<Boolean> subscriptionExistsAsync(String topicPath, String subscriptionName)
Checks whether a given subscription exists or not.- Parameters:
topicPath
- - Path of the topicsubscriptionName
- - Name of the subscription.- Returns:
- - True if the entity exists. False otherwise.
- Throws:
IllegalArgumentException
- - path is not null / empty / too long / invalid.
-
ruleExistsAsync
public CompletableFuture<Boolean> ruleExistsAsync(String topicPath, String subscriptionName, String ruleName)
Checks whether a given rule exists or not for a given subscription.- Parameters:
topicPath
- - Path of the topicsubscriptionName
- - Name of the subscription.ruleName
- - Name of the rule- Returns:
- - True if the entity exists. False otherwise.
- Throws:
IllegalArgumentException
- - path is not null / empty / too long / invalid.
-
deleteQueueAsync
public CompletableFuture<Void> deleteQueueAsync(String path)
Deletes the queue described by the path relative to the service namespace base address.- Parameters:
path
- - The name of the entity relative to the service namespace base address.- Returns:
- A completable future that completes when the queue is deleted.
- Throws:
IllegalArgumentException
- - path is not null / empty / too long / invalid.
-
deleteTopicAsync
public CompletableFuture<Void> deleteTopicAsync(String path)
Deletes the topic described by the path relative to the service namespace base address.- Parameters:
path
- - The name of the entity relative to the service namespace base address.- Returns:
- A completable future that completes when the topic is deleted.
- Throws:
IllegalArgumentException
- - path is not null / empty / too long / invalid.
-
deleteSubscriptionAsync
public CompletableFuture<Void> deleteSubscriptionAsync(String topicPath, String subscriptionName)
Deletes the subscription described by the topicPath and the subscriptionName.- Parameters:
topicPath
- - The name of the topic.subscriptionName
- - The name of the subscription.- Returns:
- A completable future that completes when the subscription is deleted.
- Throws:
IllegalArgumentException
- - path is not null / empty / too long / invalid.
-
deleteRuleAsync
public CompletableFuture<Void> deleteRuleAsync(String topicPath, String subscriptionName, String ruleName)
Deletes the rule for a given topic-subscription.- Parameters:
topicPath
- - The name of the topic.subscriptionName
- - The name of the subscription.ruleName
- - The name of the rule.- Returns:
- A completable future that completes when the rule is deleted.
- Throws:
IllegalArgumentException
- - path is not null / empty / too long / invalid.
-
close
public void close() throws IOException
Disposes and closes the managementClient.- Throws:
IOException
- if an I/O error occurs
-
-