クラス 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または (ステートレス)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();- 導入:
- 1.3
- 作成者:
- James Carr, Gary Russell, Artem Bilan
ネストされたクラスの概要
ネストされたクラス 修飾子と型 クラス 説明 static classRetryInterceptorBuilder.StatefulRetryInterceptorBuilderステートフルインターセプターのビルダー。static classRetryInterceptorBuilder.StatelessRetryInterceptorBuilderステートレスインターセプターのビルダー。
コンストラクター概要
コンストラクター コンストラクター 説明 RetryInterceptorBuilder()
方法の概要
すべてのメソッド 静的メソッド インスタンスメソッド 抽象メソッド 具象メソッド 修飾子と型 メソッド 説明 protected B_this()protected voidapplyCommonSettings(AbstractRetryOperationsInterceptorFactoryBean factoryBean)BbackOffOptions(long initialInterval, double multiplier, long maxInterval)バックオフオプションを適用します。BbackOffPolicy(org.springframework.retry.backoff.BackOffPolicy policy)バックオフポリシーを適用します。abstract Tbuild()BmaxAttempts(int maxAttempts)最大試行回数を適用します - SimpleRetryPolicy が使用されます。Brecoverer(MessageRecoverer recoverer)メッセージリカバリを適用します。デフォルトでは、再試行が使い果たされた後にログに記録して破棄します。BretryOperations(org.springframework.retry.RetryOperations retryOperations)再試行操作を適用します。これが設定されると、他のプロパティは設定できなくなります。他のプロパティが適用されている場合は設定できません。BretryPolicy(org.springframework.retry.RetryPolicy policy)再試行ポリシーを適用する - カスタム再試行テンプレートが提供されている場合、または最大試行回数またはバックオフオプションまたはポリシーが適用されている場合は使用できません。static RetryInterceptorBuilder.StatefulRetryInterceptorBuilderstateful()ステートフルな再試行インターセプターのビルダーを作成します。static RetryInterceptorBuilder.StatelessRetryInterceptorBuilderstateless()ステートレス再試行インターセプターのビルダーを作成します。
メソッドの詳細
stateful
public static RetryInterceptorBuilder.StatefulRetryInterceptorBuilder stateful()
ステートフルな再試行インターセプターのビルダーを作成します。- 戻り値:
- インターセプタービルダー。
stateless
public static RetryInterceptorBuilder.StatelessRetryInterceptorBuilder stateless()
ステートレス再試行インターセプターのビルダーを作成します。- 戻り値:
- インターセプタービルダー。
_this
protected final B _this()
retryOperations
public B retryOperations(org.springframework.retry.RetryOperations retryOperations)
再試行操作を適用します。これが設定されると、他のプロパティは設定できなくなります。他のプロパティが適用されている場合は設定できません。- パラメーター:
retryOperations- 再試行操作。- 戻り値:
- this。
maxAttempts
public B maxAttempts(int maxAttempts)
最大試行回数を適用します - SimpleRetryPolicy が使用されます。カスタムの再試行操作または再試行ポリシーが設定されている場合は使用できません。- パラメーター:
maxAttempts- 最大試行回数。- 戻り値:
- this。
backOffOptions
public B backOffOptions(long initialInterval, double multiplier, long maxInterval)
バックオフオプションを適用します。カスタムの再試行操作またはバックオフポリシーが設定されている場合は使用できません。- パラメーター:
initialInterval- 初期間隔。multiplier- 乗数。maxInterval- 最大間隔。- 戻り値:
- this。
retryPolicy
public B retryPolicy(org.springframework.retry.RetryPolicy policy)
再試行ポリシーを適用する - カスタム再試行テンプレートが提供されている場合、または最大試行回数またはバックオフオプションまたはポリシーが適用されている場合は使用できません。- パラメーター:
policy- ポリシー。- 戻り値:
- this。
backOffPolicy
public B backOffPolicy(org.springframework.retry.backoff.BackOffPolicy policy)
バックオフポリシーを適用します。カスタムの再試行操作またはバックオフポリシーが適用されている場合は使用できません。- パラメーター:
policy- ポリシー。- 戻り値:
- this。
recoverer
public B recoverer(MessageRecoverer recoverer)
メッセージリカバリを適用します。デフォルトでは、再試行が使い果たされた後にログに記録して破棄します。- パラメーター:
recoverer- 回復者。- 戻り値:
- this。
applyCommonSettings
protected void applyCommonSettings(AbstractRetryOperationsInterceptorFactoryBean factoryBean)
build
public abstract T build()