ActiveMQ - Caching

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).

  1. fixedSizeSubscriptionRecoveryPolicy : how large the messages.

  2. fixedCountSubscriptionRecoveryPolicy : how many messages.

  3. lastImageSubscriptionRecoveryPolicy : cache the last message.

  4. timedSubscriptionRecoveryPolicy : how long to cache

  5. noSubscriptionRecoveryPolicy : disable the cache.


Any cache for Queue?

No. The normal operation for queue is to hold every message sent to it.

相關文章
相關標籤/搜索