ServiceBusRuleManagerClient Class
- java.
lang. Object - com.
azure. messaging. servicebus. ServiceBusRuleManagerClient
- com.
Implements
public class ServiceBusRuleManagerClient
implements AutoCloseable
A synchronous rule manager responsible for managing rules for a specific topic subscription. The rule manager requires only Listen claims, whereas the ServiceBusAdministrationAsyncClient requires Manage claims.
Create a rule to a Service Bus subscription
TokenCredential credential = new DefaultAzureCredentialBuilder().build();
// 'fullyQualifiedNamespace' will look similar to "{your-namespace}.servicebus.windows.net"
ServiceBusRuleManagerClient ruleManager = new ServiceBusClientBuilder()
.credential(fullyQualifiedNamespace, credential)
.ruleManager()
.topicName(topicName)
.subscriptionName(subscriptionName)
.buildClient();
RuleFilter trueRuleFilter = new TrueRuleFilter();
CreateRuleOptions options = new CreateRuleOptions(trueRuleFilter);
ruleManager.createRule("new-rule", options);
// Dispose of the ruleManager when finished using it.
ruleManager.close();
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
close()
Disposes of the ServiceBusRuleManagerClient. |
void |
createRule(String ruleName, CreateRuleOptions options)
Creates a rule to the current subscription to filter the messages reaching from topic to the subscription. |
void |
deleteRule(String ruleName)
Removes the rule on the subscription identified by |
String |
getEntityPath()
Gets the name of the Service Bus resource. |
String |
getFullyQualifiedNamespace()
Gets the fully qualified namespace. |
Iterable |
listRules()
Fetches all rules associated with the topic and subscription. |
Methods inherited from java.lang.Object
Method Details
close
public void close()
Disposes of the ServiceBusRuleManagerClient. If the client has a dedicated connection, the underlying connection is also closed.
createRule
public void createRule(String ruleName, CreateRuleOptions options)
Creates a rule to the current subscription to filter the messages reaching from topic to the subscription.
Parameters:
deleteRule
public void deleteRule(String ruleName)
Removes the rule on the subscription identified by ruleName
.
Parameters:
getEntityPath
public String getEntityPath()
Gets the name of the Service Bus resource.
Returns:
getFullyQualifiedNamespace
public String getFullyQualifiedNamespace()
Gets the fully qualified namespace.
Returns:
listRules
public IterableStream
Fetches all rules associated with the topic and subscription.
Returns:
Applies to
Azure SDK for Java