クラス RepublishMessageRecoverer
- java.lang.ObjectSE
-
- org.springframework.amqp.rabbit.retry.RepublishMessageRecoverer
- 実装済みのインターフェース一覧:
MessageRecoverer
- 既知の直属サブクラス
RepublishMessageRecovererWithConfirms
public class RepublishMessageRecoverer extends ObjectSE implements MessageRecoverer
メッセージヘッダー x-exception に格納された例外スタックトレースを使用して、復元されたメッセージを指定された交換に再発行するMessageRecoverer実装。ルーティングキーが指定されていない場合、メッセージの元のルーティングキーに
setErrorRoutingKeyPrefix(String)(デフォルトの "error." ) がプレフィックスとして付けられ、名前で指定された交換にメッセージを発行するために使用されます。何も設定されていない場合は、テンプレートのデフォルトの交換に発行されます。- 導入:
- 1.3
- 作成者:
- James Carr, Gary Russell, Artem Bilan
フィールド概要
フィールド 修飾子と型 フィールド 説明 static intDEFAULT_FRAME_MAX_HEADROOMprotected StringSEerrorExchangeNameprotected StringSEerrorRoutingKeyprotected AmqpTemplateerrorTemplateprotected Logloggerstatic StringSEX_EXCEPTION_MESSAGEstatic StringSEX_EXCEPTION_STACKTRACEstatic StringSEX_ORIGINAL_EXCHANGEstatic StringSEX_ORIGINAL_ROUTING_KEY
コンストラクター概要
コンストラクター コンストラクター 説明 RepublishMessageRecoverer(AmqpTemplate errorTemplate)RepublishMessageRecoverer(AmqpTemplate errorTemplate, StringSE errorExchange)RepublishMessageRecoverer(AmqpTemplate errorTemplate, StringSE errorExchange, StringSE errorRoutingKey)
方法の概要
すべてのメソッド インスタンスメソッド 具象メソッド 修飾子と型 メソッド 説明 protected MapSE<? extends StringSE,?>additionalHeaders(Message message, ThrowableSE cause)サブクラスは、このメソッドをオーバーライドして、再発行されたメッセージにヘッダーを追加できます。protected voiddoSend(StringSE exchange, StringSE routingKey, Message message)メッセージを送信します。RepublishMessageRecoverererrorRoutingKeyPrefix(StringSE errorRoutingKeyPrefix)送信 ルーティングキーにプレフィックスを適用します。これは、元のメッセージルーティングキーのプレフィックスになります (コンストラクターで明示的なルーティングキーが指定されていない場合。それ以外の場合は無視されます)。RepublishMessageRecovererframeMaxHeadroom(int headroom)スタックトレースヘッダーの切り捨てを考慮するときに、ネゴシエートされた frame_max を削減する量を設定します。protected MessageDeliveryModegetDeliveryMode()protected StringSEgetErrorRoutingKeyPrefix()voidrecover(Message message, ThrowableSE cause)消費されましたがすべての再試行に失敗したメッセージのコールバック。voidsetDeliveryMode(MessageDeliveryMode deliveryMode)メッセージにMessageDeliveryModeが設定されていない場合は、再発行するメッセージに設定するMessageDeliveryModeを指定します。voidsetErrorRoutingKeyPrefix(StringSE errorRoutingKeyPrefix)
フィールドの詳細
DEFAULT_FRAME_MAX_HEADROOM
public static final int DEFAULT_FRAME_MAX_HEADROOM
- 関連事項:
- 定数フィールド値
logger
protected final Log logger
errorTemplate
protected final AmqpTemplate errorTemplate
errorRoutingKey
protected final StringSE errorRoutingKey
errorExchangeName
protected final StringSE errorExchangeName
コンストラクターの詳細
RepublishMessageRecoverer
public RepublishMessageRecoverer(AmqpTemplate errorTemplate)
RepublishMessageRecoverer
public RepublishMessageRecoverer(AmqpTemplate errorTemplate, StringSE errorExchange)
RepublishMessageRecoverer
public RepublishMessageRecoverer(AmqpTemplate errorTemplate, StringSE errorExchange, StringSE errorRoutingKey)
メソッドの詳細
errorRoutingKeyPrefix
public RepublishMessageRecoverer errorRoutingKeyPrefix(StringSE errorRoutingKeyPrefix)
送信 ルーティングキーにプレフィックスを適用します。これは、元のメッセージルーティングキーのプレフィックスになります (コンストラクターで明示的なルーティングキーが指定されていない場合は無視されます。それ以外の場合は無視されます。プレフィックスを付けない場合は、空の文字列 ("") を使用します)。- パラメーター:
errorRoutingKeyPrefix- プレフィックス (デフォルトは "error." )。- 戻り値:
- this。
frameMaxHeadroom
public RepublishMessageRecoverer frameMaxHeadroom(int headroom)
スタックトレースヘッダーの切り捨てを考慮するときに、ネゴシエートされた frame_max を削減する量を設定します。デフォルトは 20000 です。- パラメーター:
headroom- ヘッドルーム- 戻り値:
- this。
- 導入:
- 2.0.5
setErrorRoutingKeyPrefix
public void setErrorRoutingKeyPrefix(StringSE errorRoutingKeyPrefix)
- パラメーター:
errorRoutingKeyPrefix- プレフィックス (デフォルトは "error." )。- 関連事項:
errorRoutingKeyPrefix(String)
getErrorRoutingKeyPrefix
protected StringSE getErrorRoutingKeyPrefix()
setDeliveryMode
public void setDeliveryMode(MessageDeliveryMode deliveryMode)
メッセージにMessageDeliveryModeが設定されていない場合は、再発行するメッセージに設定するMessageDeliveryModeを指定します。- パラメーター:
deliveryMode- メッセージに設定する配信モード。- 導入:
- 2.0
getDeliveryMode
protected MessageDeliveryMode getDeliveryMode()
recover
public void recover(Message message, ThrowableSE cause)
インターフェースからコピーされた説明:MessageRecoverer消費されましたがすべての再試行に失敗したメッセージのコールバック。- 次で指定:
- インターフェース
MessageRecoverer内のrecover - パラメーター:
message- 回復へのメッセージcause- エラーの原因
doSend
protected void doSend(@Nullable StringSE exchange, StringSE routingKey, Message message)
メッセージを送信します。- パラメーター:
exchange- テンプレートのデフォルトを使用する場合は exchange または null。routingKey- ルーティングキー。message- メッセージ。- 導入:
- 2.3.3
additionalHeaders
protected MapSE<? extends StringSE,?> additionalHeaders(Message message, ThrowableSE cause)
サブクラスは、このメソッドをオーバーライドして、再発行されたメッセージにヘッダーを追加できます。- パラメーター:
message- 失敗したメッセージ。cause- 原因。- 戻り値:
- 追加する追加ヘッダーの
MapSE。