B - 対象の RetryInterceptorBuilder 実装型。T - ビルダーの build() メソッドによって返される MethodInterceptor の型。public abstract class RetryInterceptorBuilder<B extends RetryInterceptorBuilder<B,T>,T extends MethodInterceptor> extends ObjectSE
エラー時の動作を定義する流れるようなインターフェースを提供することで、StatefulRetryOperationsInterceptor または (ステートレス) RetryOperationsInterceptor の構築をより簡単かつシンプルにするための単純化されたファサード。
典型的な例:
StatefulRetryOperationsInterceptor interceptor =
RetryInterceptorBuilder.stateful()
.maxAttempts(5)
.backOffOptions(1, 2, 10) // initialInterval, multiplier, maxInterval
.build();
ステートフルインターセプタを構築する場合、メッセージ識別子が必要です。デフォルトの動作では、messageId に基づいてメッセージ ID が決定されます。これは必須フィールドではなく、送信者が設定できない場合があります。そうでない場合は、ロジックを変更して、カスタムジェネレーターを使用してメッセージ ID を決定できます。
StatefulRetryOperationsInterceptor interceptor = RetryInterceptorBuilder.stateful()
.messageKeyGenerator(new MyMessageKeyGenerator())
.build();
| 修飾子と型 | クラスと説明 |
|---|---|
static class | RetryInterceptorBuilder.StatefulRetryInterceptorBuilder ステートフルインターセプターのビルダー。 |
static class | RetryInterceptorBuilder.StatelessRetryInterceptorBuilder ステートレスインターセプターのビルダー。 |
| コンストラクターと説明 |
|---|
RetryInterceptorBuilder() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected B | _this() |
protected void | applyCommonSettings(AbstractRetryOperationsInterceptorFactoryBean factoryBean) |
B | backOffOptions(long initialInterval, double multiplier, long maxInterval) バックオフオプションを適用します。 |
B | backOffPolicy(org.springframework.retry.backoff.BackOffPolicy policy) バックオフポリシーを適用します。 |
abstract T | build() |
B | maxAttempts(int maxAttempts) 最大試行回数を適用します - SimpleRetryPolicy が使用されます。 |
B | recoverer(MessageRecoverer recoverer) メッセージリカバリを適用します。デフォルトでは、再試行が使い果たされた後にログに記録して破棄します。 |
B | retryOperations(org.springframework.retry.RetryOperations retryOperations) 再試行操作を適用します。これが設定されると、他のプロパティは設定できなくなります。他のプロパティが適用されている場合は設定できません。 |
B | retryPolicy(org.springframework.retry.RetryPolicy policy) 再試行ポリシーを適用する - カスタム再試行テンプレートが提供されている場合、または最大試行回数またはバックオフオプションまたはポリシーが適用されている場合は使用できません。 |
static RetryInterceptorBuilder.StatefulRetryInterceptorBuilder | stateful() ステートフルな再試行インターセプターのビルダーを作成します。 |
static RetryInterceptorBuilder.StatelessRetryInterceptorBuilder | stateless() ステートレス再試行インターセプターのビルダーを作成します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEpublic static RetryInterceptorBuilder.StatefulRetryInterceptorBuilder stateful()
public static RetryInterceptorBuilder.StatelessRetryInterceptorBuilder stateless()
protected final B _this()
public B retryOperations(org.springframework.retry.RetryOperations retryOperations)
retryOperations - 再試行操作。public B maxAttempts(int maxAttempts)
maxAttempts - 最大試行回数。public B backOffOptions(long initialInterval, double multiplier, long maxInterval)
initialInterval - 初期間隔。multiplier - 乗数。maxInterval - 最大間隔。public B retryPolicy(org.springframework.retry.RetryPolicy policy)
policy - ポリシー。public B backOffPolicy(org.springframework.retry.backoff.BackOffPolicy policy)
policy - ポリシー。public B recoverer(MessageRecoverer recoverer)
recoverer - 回復者。protected void applyCommonSettings(AbstractRetryOperationsInterceptorFactoryBean factoryBean)
public abstract T build()