Types of Durables: Standard, Shared, Last-Value, Map

Each type of durable supports a different set of use cases.

Standard Durable
A durable that represents the interest of one subscriber object, strengthening delivery assurance for that subscriber.

Use a standard durable when a subscriber must receive every message in a message stream, even if the subscriber is intermittently disconnected from the message bus. 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.
Shared Durable
A durable that represents the identical interest of two or more cooperating subscriber objects, apportioning a message stream among those subscribers.

Use a shared durable when a set of subscribers collectively process a message stream in a distributed or parallel fashion, processing every message exactly once.

Last-Value Durable
A durable that represents the interest of potentially many subscriber objects. It stores only the most recent message from one or more message streams.

Use a last-value durable to hold recent context for initializing new subscribers.

Map Durable
A durable that stores a key/value mapping. When a message arrives, a map durable uses the value in the message's key field as the key, and stores the full message as its value. For each distinct key, the durable stores only the most recent value. (Notice that one map durable can hold many key/value pairs.)

Applications can use the map API to get the current value of a key, or to store a key/value pair.

Key values must be strings.