ActiveMQ - Caching
博客专区 > nicholcz 的博客 > 博客详情
ActiveMQ - Caching
nicholcz 发表于3年前
ActiveMQ - Caching
  • 发表于 3年前
  • 阅读 13
  • 收藏 0
  • 点赞 0
  • 评论 0

Why we want  to persist messages?

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


Why to want to use cache?

- For some real-time data delivery cases, it's pointless to persist because new messages will arrive soon.


How caching works for topic consumer?

- ActiveMQ will cache messages in memory for every topic but only dispatch them to 'retroactive' topic consumers not 'durable' ones.


How to create retroactive topic consumer?

Topic topic = session.createTopic("TEST.TOPIC?consumer.retroactive=true");

MessageConsumer consumer = session.createConsumer(topic);


Subscription recovery policy

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

共有 人打赏支持
粉丝 0
博文 19
码字总数 4226
×
nicholcz
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: