クラス RetryInterceptorBuilder<B extends RetryInterceptorBuilder<B,T>,T extends MethodInterceptor>
java.lang.ObjectSE
org.springframework.amqp.rabbit.config.RetryInterceptorBuilder<B,T>
- 型パラメーター:
B- 対象のRetryInterceptorBuilder実装型。T- ビルダーのbuild()メソッドによって返されるMethodInterceptorの型。
- 既知の直属サブクラス
RetryInterceptorBuilder.StatefulRetryInterceptorBuilder,RetryInterceptorBuilder.StatelessRetryInterceptorBuilder
public abstract class RetryInterceptorBuilder<B extends RetryInterceptorBuilder<B,T>,T extends MethodInterceptor>
extends ObjectSE
エラー時の動作を定義するための流れるようなインターフェースを提供することで、StatefulRetryOperationsInterceptor または StatelessRetryOperationsInterceptor の構築をより簡単かつシンプルにする簡素化されたファサード。
典型的な例:
StatefulRetryOperationsInterceptor interceptor =
RetryInterceptorBuilder.stateful()
.maxRetries(5)
.backOffOptions(1, 2, 10) // initialInterval, multiplier, maxInterval
.build();
ステートフルインターセプタを構築する場合、メッセージ識別子が必要です。デフォルトの動作では、messageId に基づいてメッセージ ID が決定されます。これは必須フィールドではなく、送信者が設定できない場合があります。そうでない場合は、ロジックを変更して、カスタムジェネレーターを使用してメッセージ ID を決定できます。
StatefulRetryOperationsInterceptor interceptor = RetryInterceptorBuilder.stateful()
.messageKeyGenerator(new MyMessageKeyGenerator())
.build();
- 導入:
- 1.3
- 作成者:
- James Carr, Gary Russell, Artem Bilan, Stephane Nicoll
ネストされたクラスの概要
ネストされたクラス修飾子と型クラス説明static final classステートフルインターセプターのビルダー。static final classステートレスインターセプターのビルダー。コンストラクター概要
コンストラクター方法の概要
修飾子と型メソッド説明protected final B_this()protected voidbackOffOptions(long initialInterval, double multiplier, long maxInterval) バックオフオプションを適用します。abstract Tbuild()configureRetryPolicy(ConsumerSE<RetryPolicy.Builder> retryPolicy) RetryPolicyを構成します。maxRetries(int maxRetries) 最大再試行回数を適用すると、SimpleRetryPolicy が使用されます。recoverer(MessageRecoverer recoverer) メッセージリカバリを適用します。デフォルトでは、再試行が使い果たされた後にログに記録して破棄します。retryPolicy(RetryPolicy policy) 再試行ポリシーを適用します - カスタム再試行テンプレートが提供されている場合、または再試行ポリシーがすでにカスタマイズされている場合は使用できません。stateful()ステートフルな再試行インターセプターのビルダーを作成します。ステートレス再試行インターセプターのビルダーを作成します。
コンストラクターの詳細
RetryInterceptorBuilder
public RetryInterceptorBuilder()
メソッドの詳細
stateful
ステートフルな再試行インターセプターのビルダーを作成します。- 戻り値:
- インターセプタービルダー。
stateless
ステートレス再試行インターセプターのビルダーを作成します。- 戻り値:
- インターセプタービルダー。
_this
retryPolicy
再試行ポリシーを適用します - カスタム再試行テンプレートが提供されている場合、または再試行ポリシーがすでにカスタマイズされている場合は使用できません。- パラメーター:
policy- ポリシー。- 戻り値:
- this。
configureRetryPolicy
RetryPolicyを構成します。カスタム再試行操作または再試行ポリシーが設定されている場合は使用できません。- パラメーター:
retryPolicy- ビルダーをカスタマイズするコンシューマー- 戻り値:
- this。
maxRetries
最大再試行回数を適用します。SimpleRetryPolicy が使用されます。カスタム再試行操作または再試行ポリシーが設定されている場合は使用できません。- パラメーター:
maxRetries- 再試行の最大回数。- 戻り値:
- this。
backOffOptions
バックオフオプションを適用します。カスタム再試行操作またはバックオフポリシーが設定されている場合は使用できません。- パラメーター:
initialInterval- 初期間隔。multiplier- 乗数。maxInterval- 最大間隔。- 戻り値:
- this。
recoverer
メッセージリカバリを適用します。デフォルトでは、再試行が使い果たされた後にログに記録して破棄します。- パラメーター:
recoverer- 回復者。- 戻り値:
- this。
applyCommonSettings
build