Stores and Durables

As the phrase store-and-forward intermediary suggests, the intermediary provides its functionality in two phases. Two types of data structure, store and durable, facilitate these phases.

Stores

A persistence store, or more briefly, a store, is a data structure that collects and stores a stream of messages from publishers.

Each store maintains exactly one message stream. It can collect that stream from one or more publishers. It can maintain that message stream for potentially many subscribers.

Durables

Within a store, durables maintain subscriber interest, forward messages, and track delivery acknowledgements.

  • A standard durable represents the interest of one subscriber object. It strengthens delivery assurance for that subscriber, forwarding messages to the subscriber on request. The type of persistence for a standard durable depends on whether the prefetch feature is enabled or disabled:
    • Prefetch Enabled — Messages are received and sent by the server to subscribers. The durable functions as a message broker, with no messages traveling peer-to-peer from publisher to subscriber.
    • Prefetch Disabled — Under normal conditions, messages flow directly from publisher to subscriber, with the store serving as a backup.
  • A shared durable represents the identical interest of two or more cooperating subscriber objects. It apportions a message stream among those subscribers, forwarding each message to only one available subscriber. (That subscriber can reforward the message to a different subscriber if necessary.)
  • A last-value durable represents the interest of potentially many independent subscriber objects. It divides its input message stream into a set of output sub-streams, storing only the most recent messages for each sub-stream. Upon subscribing, each new subscriber receives the most recent message. The durable continues to forward subsequent messages as they arrive.

Message Swapping

The message swapping feature swaps excess messages from process memory to disk when a memory limit is exceeded. You can set this limit on a per-store or per-durable basis. Adjusting these limits helps you to manage a balance between memory use, messaging throughput, and latency.

Clusters

For added fault tolerance, multiple persistence services can cooperate in a cluster. Within a cluster, one leader store performs message sending while the other cluster members serve as standby stores.