ActiveMQ - Caching
博客专区 > nicholcz 的博客 > 博客详情
ActiveMQ - Caching
nicholcz 发表于4年前
ActiveMQ - Caching
  • 发表于 4年前
  • 阅读 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
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
* 支付类型