Chapter 5. ActiveMQ message storage

 

This chapter covers

  • How messages are stored in ActiveMQ for both queues and topics
  • The four styles of message stores provided with ActiveMQ
  • How ActiveMQ caches messages for consumers
  • How to control message caching using subscription recovery policies

The JMS specification supports two types of message delivery: persistent and nonpersistent. A message delivered with the persistent delivery property must be logged to stable storage. For nonpersistent messages, a JMS provider must make best efforts to deliver the message, but it won’t be logged to stable storage.

ActiveMQ supports both of these types of message delivery and can also be configured to support message recovery, an in-between state where messages are cached in memory. ActiveMQ supports a pluggable strategy for message storage and provides storage options for in-memory, file-based, and relational databases.

Persistent messages are used if you want messages to always be available to a message consumer after they’ve been delivered to the broker, even if that consumer isn’t running when the message was sent. Once a message has been consumed and acknowledged by a message consumer, it’s typically deleted from the broker’s message store.

Nonpersistent messages are typically used for sending notifications or real-time data. You should use nonpersistent messages when performance is critical and guaranteed delivery of the message isn’t required.

5.1. How are messages stored by ActiveMQ?

5.2. The KahaDB message store

5.3. The AMQ message store

5.4. The JDBC message store

5.5. The memory message store

5.6. Caching messages in the broker for consumers

5.7. Summary

sitemap