Delivery Count for Standard and Shared Durables
When a shared durable or a standard durable with prefetch enabled delivers a message to a subscriber, the message includes a delivery count, indicating the number of times the persistence service has already delivered the message to this and other subscribers. It is good practice for message callbacks to check this value to confirm expected behavior.
Delivery Count = 1
If the delivery count is 1, you can infer that the subscriber is the first to receive the message.
Delivery Count Greater than 1
If the delivery count is greater than 1, it is possible that another subscriber received the message, but did not successfully process and acknowledge the message.
A higher delivery count could indicate a problem with the message. A message callback could shunt the message away from normal processing and output a log.
Administrators can set a shared durable parameter to limit the maximum delivery attempts. .
Delivery Count = -1
A delivery count of -1 can indicate any of the following conditions:
- The message is from a standard durable with prefetch disabled, or from a last-value durable.
- The message arrived through a direct path (e.g., standard durable with prefetch disabled), 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.