CommunicationClientFactoryBase<T> クラス

型パラメーター

T

通信クライアントの種類

public class CommunicationClientFactoryBase implements CommunicationClientFactory

Service Fabric サービスと通信する通信クライアントを作成するための CommunicationClientFactory の基本実装を提供します。 CommunicationClientFactoryBase クラスを拡張して、カスタム トランスポート実装用の通信クライアントを作成します。 このクラスは、通信クライアントのキャッシュを保持し、同じサービス エンドポイントへの要求に対してクライアントの再利用を試みます。

コンストラクターの概要

コンストラクター 説明
CommunicationClientFactoryBase()

通信クライアント ファクトリの新しいインスタンスを初期化します。

CommunicationClientFactoryBase(ServicePartitionResolver servicePartitionResolver, List<ExceptionHandler> exceptionHandlers)

通信クライアント ファクトリの新しいインスタンスを初期化します。

CommunicationClientFactoryBase(ServicePartitionResolver servicePartitionResolver, List<ExceptionHandler> exceptionHandlers, String traceId)

通信クライアント ファクトリの新しいインスタンスを初期化します。

メソッドの概要

修飾子と型 メソッドと説明
abstract void abortClient(T client)

指定されたクライアントを中止します

abstract CompletableFuture<T> createClientAsync(String endpoint)
CompletableFuture<T> getClientAsync(ResolvedServicePartition previousRsp, TargetReplicaSelector targetReplicaSelector, String listenerName, OperationRetrySettings retrySettings)

1 つ以上の通信リスナーを含む指定されたサービスのパーティションを解決し、指定された listenerName に対応するエンドポイントと通信するクライアントを返します。 サービスのエンドポイントは、{"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}} の形式です。

CompletableFuture<T> getClientAsync(URI serviceUri, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName, OperationRetrySettings retrySettings)

1 つ以上の通信リスナーを含む指定されたサービスのパーティションを解決し、指定された listenerName に対応するエンドポイントと通信するクライアントを返します。 サービスのエンドポイントは、{"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}} の形式です。

List<ExceptionHandler> getExceptionHandlers()

クライアントからサービスへの通信チャネルで例外を処理するためのカスタム例外ハンドラーを取得します。

ServicePartitionResolver getServiceResolver()

サービス エンドポイントを解決するためにクライアント ファクトリによって使用される ServicePartitionResolver を取得します。

String getTraceId()

CommunicationClientFactory のインスタンスを識別するために使用されるトレース識別子を取得します。 これは、トレース/ログ記録の関連付け識別子として使用されます。

CompletableFuture<OperationRetryControl> reportOperationExceptionAsync(T client, ExceptionInformation exceptionInformation, OperationRetrySettings retrySettings)

サービスにメッセージを送信するときに CommunicationClient で発生する例外を処理します

abstract boolean validateClient(String endpoint, T client)

クライアントがまだ有効で、 パラメーターで指定されたエンドポイントに接続されている場合は true を返します。

abstract boolean validateClient(T client)

クライアントがまだ有効な場合は true を返します。 接続指向トランスポートでは、このメソッドを使用して、クライアントがサービスに接続されなくなったことを示すことができます。

継承メンバー

コンストラクターの詳細

CommunicationClientFactoryBase

protected CommunicationClientFactoryBase()

通信クライアント ファクトリの新しいインスタンスを初期化します。

CommunicationClientFactoryBase

protected CommunicationClientFactoryBase(ServicePartitionResolver servicePartitionResolver, List exceptionHandlers)

通信クライアント ファクトリの新しいインスタンスを初期化します。

パラメーター:

servicePartitionResolver - 省略可能な ServicePartitionResolver
exceptionHandlers - クライアントからサービスへの通信チャネルの例外に対するオプションのカスタム例外ハンドラー

CommunicationClientFactoryBase

protected CommunicationClientFactoryBase(ServicePartitionResolver servicePartitionResolver, List exceptionHandlers, String traceId)

通信クライアント ファクトリの新しいインスタンスを初期化します。

パラメーター:

servicePartitionResolver - 省略可能な ServicePartitionResolver
exceptionHandlers - クライアントからサービスへの通信チャネルの例外に対するオプションのカスタム例外ハンドラー
traceId - このコンポーネントからのトレース診断で使用する ID。

メソッドの詳細

abortClient

protected abstract void abortClient(T client)

指定されたクライアントを中止します

パラメーター:

client - 通信クライアント

createClientAsync

protected abstract CompletableFuture createClientAsync(String endpoint)

パラメーター:

endpoint

getClientAsync

public CompletableFuture getClientAsync(ResolvedServicePartition previousRsp, TargetReplicaSelector targetReplicaSelector, String listenerName, OperationRetrySettings retrySettings)

1 つ以上の通信リスナーを含む指定されたサービスのパーティションを解決し、指定された listenerName に対応するエンドポイントと通信するクライアントを返します。 サービスのエンドポイントは、{"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}} の形式です。

パラメーター:

previousRsp - 先の ResolvedServicePartition
targetReplicaSelector -

TargetReplicaSelector

listenerName - リスナー名
retrySettings - 再試行設定

戻り値:

未処理の操作を表す CompletableFuture。 Task の結果は CommunicationClient(CommunicationClient) オブジェクトです。

getClientAsync

public CompletableFuture getClientAsync(URI serviceUri, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName, OperationRetrySettings retrySettings)

1 つ以上の通信リスナーを含む指定されたサービスのパーティションを解決し、指定された listenerName に対応するエンドポイントと通信するクライアントを返します。 サービスのエンドポイントは、{"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}} の形式です。

パラメーター:

serviceUri - 解決するサービスの URI
partitionKey - 解決するパーティションを識別するキー
targetReplicaSelector -

TargetReplicaSelector

listenerName - リスナー名
retrySettings - 再試行設定

戻り値:

未処理の操作を表す CompletableFuture。 Task の結果は CommunicationClient(CommunicationClient) オブジェクトです。

getExceptionHandlers

public List getExceptionHandlers()

クライアントからサービスへの通信チャネルで例外を処理するためのカスタム例外ハンドラーを取得します。

戻り値:

例外ハンドラーの一覧

getServiceResolver

public ServicePartitionResolver getServiceResolver()

サービス エンドポイントを解決するためにクライアント ファクトリによって使用される ServicePartitionResolver を取得します。

戻り値:

ServicePartitionResolver

getTraceId

protected String getTraceId()

CommunicationClientFactory のインスタンスを識別するために使用されるトレース識別子を取得します。 これは、トレース/ログ記録の関連付け識別子として使用されます。

戻り値:

トレース識別子

reportOperationExceptionAsync

public CompletableFuture reportOperationExceptionAsync(T client, ExceptionInformation exceptionInformation, OperationRetrySettings retrySettings)

サービスにメッセージを送信するときに CommunicationClient で発生する例外を処理します

パラメーター:

client - 通信クライアント
exceptionInformation - 例外情報
retrySettings - 再試行設定

戻り値:

未処理の操作を表す CompletableFuture。 Task の結果は、 OperationRetryControl この例外の再試行ポリシーの方法を決定するオブジェクトです。

validateClient

protected abstract boolean validateClient(String endpoint, T client)

クライアントがまだ有効で、 パラメーターで指定されたエンドポイントに接続されている場合は true を返します。

パラメーター:

endpoint - エンドポイント
client - 通信クライアント

戻り値:

クライアントが有効な場合は true、それ以外の場合は false

validateClient

protected abstract boolean validateClient(T client)

クライアントがまだ有効な場合は true を返します。 接続指向トランスポートでは、このメソッドを使用して、クライアントがサービスに接続されなくなったことを示すことができます。

パラメーター:

client - 通信クライアント

戻り値:

クライアントが有効な場合は true、それ以外の場合は false

適用対象