Message persistence allows for the recovery of undelivered messages in the event of a system failure. By default, Fuse Message Broker's persistence features are activated. The default set-up is fast and scalable. It is easy to customize the broker configuration to use a JDBC compliant database.
Loss of messages is not acceptable in mission critical applications. Fuse Message Broker reduces the risk of message loss by using a persistent message store by default. Persistent messages are written to the persistent store when they are sent. The messages persist in the store until their delivery is confirmed. This means that, in the case of a system failure, Fuse Message Broker can recover all of the undelivered messages at the time of the failure.
The default message store is embeddable and transactional. It is both very fast and extremely reliable. Fuse Message Broker implements several different kinds of message store, including:
KahaDB message store
distributed KahaDB message store
Journaled JDBC adapter
Non-journaled JDBC adapter
Fuse Message Broker caches message using message cursors. A message cursor represents a batch of messages cached in memory. When necessary, a message cursor can be used to retrieve the batch of persisted messages through the persistence adapter. See Message Cursors for details.
By default, brokers are configured to use a persistence layer to ensure that persistent messages will survive a broker failure and meet the once-and-only-once requirement of the JMS specification. Having a broker's persistence layer configured comes with a cost in terms of resources used and speed, so for testing purposes or cases where persistence will never be required, it may make sense to disable a broker's persistence layer.
Deactivating a broker's persistence layer means that a broker will treat
all messages as non-persistent. If a producer sets a message's
JMSDeliveryMode property to PERSISTENT
the broker will not
respect the setting. The message will be delivered at-most-once instead of
once-and-only-once. This means that persistent messages will not
survive broker shutdown.
Persistence in Fuse Message Broker is controlled by a broker's XML configuration file. To change a
broker's persistence behavior you modify the configuration's broker
element's persistent
attribute.
Table 1.1. Setting a Broker's Persistence
Value | Description |
---|---|
true | The broker will use a persistent message store and respect the value of a message's JMSDeliveryMode setting. |
false | The broker will not use a persistent message store and will treat all messages as non-persistent regardless of the value of a message's JMSDeliveryMode setting. |
Example 1.1 shows a configuration snippet for turning off a broker's message persistence.
Fuse Message Broker offers a number of different persistence mechanisms besides the default
message store. To use one of the alternative message stores, or to modify the behavior
of the default message store, you need to configure the persistence adapter. This is done
by adding a persistenceAdapter
element or a
persistenceFactory
element (depending on the kind of adapter you
want to use) to the broker's configuration file.