20.6.11. メッセージの有効期限の設定
送信されたメッセージが指定期間 (ミリ秒単位) 後にコンシューマーへ配達されなかった場合、サーバー側で期限切れになるように設定できます。Java Messaging Service (JMS) または HornetQ Core API を使用して、期限切れの時間を直接メッセージに設定できます。例は次のとおりです。
// message will expire in 5000ms from now message.setExpiration(System.currentTimeMillis() + 5000);
MessageProducer には送信するメッセージの有効期限を制御する TimeToLive パラメーターが含まれています。
// messages sent by this producer will be retained for 5s (5000ms) before expiration producer.setTimeToLive(5000);
- _HQ_ORIG_ADDRESS
- _HQ_ACTUAL_EXPIRY
期限切れアドレスは address-setting 設定で定義されます。
<!-- expired messages in exampleQueue will be sent to the expiry address expiryQueue --> <address-setting match="jms.queue.exampleQueue"> <expiry-address>jms.queue.expiryQueue</expiry-address> </address-setting>
リーパー (reaper) スレッドは、メッセージの期限切れを検証するためにキューを定期的に検査します。
- message-expiry-scan-period
- message-expiry-thread-priority

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.