ActiveMQ是否为离线持久化消息订阅者存储非持久化消息至KahaDB?
Great question—this is a nuanced behavior that trips up a lot of ActiveMQ users, so let’s break it down clearly:
Non-persistent messages for offline durable subscribers are NOT stored in KahaDB
KahaDB (and other persistent message stores) are reserved exclusively for persistent messages. Non-persistent messages, by definition, aren’t meant to be persisted long-term, regardless of whether the subscriber is durable or not.They’re held in memory first, with disk fallback via
tempUsage
When a durable subscriber goes offline, the ActiveMQ broker will temporarily hold their pending non-persistent messages in memory. If the volume of these messages exceeds the memory limits configured viatempUsage, the broker will spill the excess to a temporary disk storage area (separate from the KahaDB persistent directory).These messages are temporary, not permanent
Once the durable subscriber reconnects, the broker will deliver these cached non-persistent messages and then clear them. If the subscriber stays offline indefinitely, the broker will eventually clean up these messages based on its expiry configuration (likeconsumerExpiryCheckInterval), so they won’t linger forever.
内容的提问来源于stack exchange,提问作者learner

