Delivery Count for Shared Durables

When a persistence service delivers a message from a shared durable to a subscriber, it includes a delivery count, indicating the number of times the persistence service has already delivered the message to other subscribers. It is good practice for message callbacks in application programs to check this value as evidence for messages that cause unexpected behavior.

Greater than Zero

If the delivery count is greater than zero, you can infer that one or more subscribing application processes received the message, but did not finish processing the message.

A higher delivery count correlates with higher probability that the message itself causes unexpected behavior in applications that attempt to process it. A message callback could shunt the message away from normal processing and output a log.

Administrators can set a parameter of shared durables to limit the maximum delivery attempts. Nonetheless, robust subscribing applications test the delivery count to defend against problematic messages.

Zero

If the delivery count is zero, you can infer that the application is the first to receive the message from the persistence service.

Less than Zero

A delivery count of -1 can indicate any of the following conditions:
  • The message is not in a shared durable, but some other type of durable.
  • The message arrived through a direct path, rather than from a persistence service.
  • The persistence service predates the tracking of delivery counts.

A message callback can ignore this value and continue processing the message.