Why we want to persist messages?session
- There are a number of cases where messages are required to be available for consumers that were disconnected from the broker, so we want these messages to survive in long-term storage.less
Why to want to use cache?ui
- For some real-time data delivery cases, it's pointless to persist because new messages will arrive soon.this
How caching works for topic consumer?spa
- ActiveMQ will cache messages in memory for every topic but only dispatch them to 'retroactive' topic consumers not 'durable' ones.orm
How to create retroactive topic consumer?ip
Topic topic = session.createTopic("TEST.TOPIC?consumer.retroactive=true");it
MessageConsumer consumer = session.createConsumer(topic);io
Subscription recovery policyast
- We can configure this policy about what types of messages to cache, how many, how long(duration).
fixedSizeSubscriptionRecoveryPolicy : how large the messages.
fixedCountSubscriptionRecoveryPolicy : how many messages.
lastImageSubscriptionRecoveryPolicy : cache the last message.
timedSubscriptionRecoveryPolicy : how long to cache
noSubscriptionRecoveryPolicy : disable the cache.
Any cache for Queue?
No. The normal operation for queue is to hold every message sent to it.