ServiceBusRuleManagerAsyncClient クラス
- java.
lang. Object - com.
azure. messaging. servicebus. ServiceBusRuleManagerAsyncClient
- com.
実装
public class ServiceBusRuleManagerAsyncClient
implements AutoCloseable
特定のトピック サブスクリプションのルールを管理する 非同期 ルール マネージャー。 ルール マネージャーではリッスン要求のみが必要ですが、 には要求の管理が ServiceBusAdministrationAsyncClient 必要です。
ルール マネージャーのインスタンスを作成する
// The required parameters is connectionString, a way to authenticate with Service Bus using credentials.
// The connectionString/queueName must be set by the application. The 'connectionString' format is shown below.
// "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}"
TokenCredential credential = new DefaultAzureCredentialBuilder().build();
// 'fullyQualifiedNamespace' will look similar to "{your-namespace}.servicebus.windows.net"
ServiceBusRuleManagerAsyncClient ruleManager = new ServiceBusClientBuilder()
.credential(fullyQualifiedNamespace, credential)
.ruleManager()
.topicName(topicName)
.subscriptionName(subscriptionName)
.buildAsyncClient();
Service Bus サブスクリプションに対するルールを作成する
RuleFilter trueRuleFilter = new TrueRuleFilter();
CreateRuleOptions options = new CreateRuleOptions(trueRuleFilter);
// `subscribe` is a non-blocking call. After setting up the create rule operation, it will move onto the next
// line of code to execute.
// Consider using Mono.usingWhen to scope the creation, usage, and cleanup of the rule manager.
ruleManager.createRule("new-rule", options).subscribe(
unused -> {
},
err -> System.err.println("Error occurred when create a rule, err: " + err),
() -> System.out.println("Create complete.")
);
// Finally dispose of the rule manager when done using it.
ruleManager.close();
すべてのルールをフェッチします。
// `subscribe` is a non-blocking call. After setting up the list rules operation, it will move onto the next
// line of code to execute.
ruleManager.listRules().subscribe(ruleProperties -> System.out.println(ruleProperties.getName()));
ルールを削除します。
// `subscribe` is a non-blocking call. After setting up the delete rule operation, it will move onto the next
// line of code to execute.
ruleManager.deleteRule("exist-rule").subscribe(
unused -> { },
err -> System.err.println("Error occurred when delete rule, err: " + err),
() -> System.out.println("Delete complete.")
);
メソッドの概要
修飾子と型 | メソッドと説明 |
---|---|
void |
close()
を破棄します ServiceBusRuleManagerAsyncClient。 |
Mono<Void> |
createRule(String ruleName, CreateRuleOptions options)
現在のサブスクリプションに対して、トピックからサブスクリプションに到達するメッセージをフィルター処理するルールを作成します。 |
Mono<Void> |
deleteRule(String ruleName)
によって識別されるサブスクリプションのルールを |
String |
getEntityPath()
Service Bus リソースの名前を取得します。 |
String |
getFullyQualifiedNamespace()
完全修飾名前空間を取得します。 |
Flux<Rule |
listRules()
トピックとサブスクリプションに関連付けられているすべてのルールをフェッチします。 |
メソッドの継承元: java.lang.Object
メソッドの詳細
close
public void close()
を破棄します ServiceBusRuleManagerAsyncClient。 クライアントに専用接続がある場合は、基になる接続も閉じられます。
createRule
public Mono
現在のサブスクリプションに対して、トピックからサブスクリプションに到達するメッセージをフィルター処理するルールを作成します。
Parameters:
Returns:
deleteRule
public Mono
によって識別されるサブスクリプションのルールを ruleName
削除します。
Parameters:
Returns:
getEntityPath
public String getEntityPath()
Service Bus リソースの名前を取得します。
Returns:
getFullyQualifiedNamespace
public String getFullyQualifiedNamespace()
完全修飾名前空間を取得します。
Returns:
listRules
public Flux
トピックとサブスクリプションに関連付けられているすべてのルールをフェッチします。
Returns:
適用対象
Azure SDK for Java
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示