ORIG message propertes like _AMQ_ORIG_ADDRESS are added to messages during various broker operations (e.g. diverting a message, expiring a message, etc.). However, if multiple operations try to set these properties on the same message (e.g. administratively moving a message which eventually gets sent to a dead-letter address) then important details can be lost. This is particularly problematic when using auto-created dead-letter or expiry resources which use filters based on _AMQ_ORIG_ADDRESS and can lead to message loss. This commit simply over-writes the existing ORIG properties rather than preserving them so that the most recent information is available.
1.4 KiB
Properties for Copied Messages
There are several operations within the broker that result in copying a message. These include:
- Diverting a message from one address to another.
- Moving an expired message from a queue to the configured
expiry-address
- Moving a message which has exceeded its
max-delivery-attempts
from a queue to the configureddead-letter-address
- Using the management API to administratively move messages from one queue to another
When this happens the body and properties of the original message are copied to a new message. However, the copying process removes some potentially important pieces of data so those are preserved in the following special message properties:
-
_AMQ_ORIG_ADDRESS
a String property containing the original address of the message
-
_AMQ_ORIG_QUEUE
a String property containing the original queue of the message
-
_AMQ_ORIG_MESSAGE_ID
a String property containing the original message ID of the message
It's possible for the aforementioned operations to be combined. For example, a message may be diverted from one address to another where it lands in a queue and a consumer tries & fails to consume it such that the message is then sent to a dead-letter address. Or a message may be administratively moved from one queue to another where it then expires.
In cases like these the ORIG
properties will contain the information from the
last (i.e. most recent) operation.