JMSRedelivered — Purpose: Routing
The
JMSRedelivered
header indicates if the message was redelivered to the consumer. The
JMSRedelivered
header is true
if the message has been redelivered, and false
if
has not. A message may be marked as redelivered if a consumer failed
to acknowledge delivery, or if the JMS provider is otherwise
uncertain whether the consumer received the message.
When a message is delivered to a consumer, the consumer must
acknowledge receipt of the
message. If it doesn't, the message server may attempt to
redeliver the message. Consumers can acknowledge messages
automatically or manually, depending on how the consumer was created.
A consumer created with an acknowledgment mode of
AUTO_ACKNOWLEDGE
or
DUPS_OK_ACKNOWLEDGE
automatically informs the message server
that the message was received. When the consumer is created with
CLIENT_ACKNOWLEDGE
mode, the JMS client must manually
acknowledge the messages.
In general, when a message has a JMSRedelivered
value of false
, the consumer should assume that
there is no chance it has seen this message before. If the
redelivered flag is true,
the client may have been
given this message before so it may need to take some precautions it
would not otherwise take. Redelivery can occur under a variety of
conditions, and a JMS provider may mark a message as redelivered when
it's in doubt due to failures, error conditions, and other
anomalous conditions.
Message acknowledgment and redelivery are covered in detail in Chapter 6. Durable subscribers are addressed in Chapter 4.