Persistence: Stores and Durables

Persistence is when an odd number of stores are used in a stream to provide temporary message storage. Persistence allows applications to store a stream of messages even while the subscribers are off line, there by allowing subscribers to consume stored messages at a later time.

Persistence Stores

A store holds messages sent by a publisher until they are consumed by a subscriber. A persistent store is a store that is replicated to further ensure against loss of messages. Administrators configure stores within an FTL persistence service and tailor various aspects of persistence to meet the needs of applications.

Each store collects and maintains a message stream and can collect the stream from one or more publishers. The store can maintain that message stream for one or many subscribers.

A durable with a store expresses interest that endures even when no subscriber object is present, maintaining persistent interest for the benefit of subscribers.

Stores can be replicated and back each other. Non-replicated stores provide some level of persistence in cases where subscribers are temporarily unreachable.

A store can apportion a message stream among a set of cooperating subscribers where only one subscriber receives and processes each message. Acting together the subscribers process every message in the stream.

In a persistence store, a program uses akey/value map to stores key/value pairs where each key is a string and a key's value is a message. Programs can use map methods to store and retrieve key/value pairs, and to iterate over the pairs in a map. This is a way to use the store as a simple database table.

Durables

A durable is the data structure within a store that maintains subscriber interest, forwards messages, and tracks delivery acknowledgments.

There are different types of durables.

  • Standard Durable: A standard durable represents the interest of one subscriber object. It forwards messages to the subscriber on request. The type of persistence for a standard durable depends on whether prefetch is enabled or disabled:
    • Prefetch Enabled: The store functions as a message broker, with no messages traveling peer-to-peer from publisher to subscriber.
    • Prefetch Disabled: Messages typically flow directly from publisher to subscriber and the store serves as a backup.
      For details, see Prefetch: Enabled Versus Disabled.
  • Shared Durable: A shared durable represents the identical interest of one or more cooperating subscriber objects. It apportions a message stream among those subscribers, forwarding each message to only one available subscriber, and ensures that exactly one of those subscribers acknowledges each message in the message stream. That subscriber can re-forward the message to a different subscriber, if necessary. For details, see Standard Durable versus Shared Durable.
  • Last-Value Durable: A last-value durable preserves only the most recent message for subscribers. It does not track message acknowledgments from subscribers. A last value durable divides its input message stream into output sub-streams based on a key field in each message and retains only one message for each output sub-stream. Programs can subscribe to individual sub-streams. Each new subscriber receives the most recent stored message and continues to receive the sub-stream of subsequent messages.
  • Dynamic Durable: A dynamic durable uses a dynamic durable template used by subscribers to the durable to create a set of durables at run time. Programmers take responsibility for the number of durables and their names.
  • Static Durable: A static durable is defined in advance of any subscribers and is defined in the realm configuration. Administrators control the number of durables and their names.
  • Wide-Area Durable: A wide-area durable is part of a persistent store that is available to publishers and subscribers across different networks. For details, see Wide-Area Forwarding.