Sender-selected Distribution
The routing logic in AMQP 0-9-1 does not offer a way for message publishers to select intended recipients unless they bind their queues to the target destination (an exchange).
The RabbitMQ broker treats the "CC" and "BCC" message headers in a special way to overcome this limitation. This is the equivalent of entering multiple recipients in the "CC" or "BCC" field of an email.
The values associated with the "CC" and "BCC" header keys will
be added to the routing key if they are present. The message
will be routed to all destinations matching the routing key
supplied as a parameter to the basic.publish
method, as well as the routes supplied in the "CC" and "BCC"
headers. The type of "CC" and "BCC" values must be an array
of strings (longstr
values) and these keys are case-sensitive. If the header does not
contain "CC" or "BCC" keys then this extension has no effect.
The "BCC" key and value will be removed from the message prior to delivery, offering some confidentiality among consumers. This feature is a deviation from the AMQP 0-9-1 specification which forbids any message modification, including headers. This feature imposes a small performance penalty.
This extension is independent of the client library used. Any AMQP 0-9-1 client with the ability to set header values at the time of publishing can make use of this extension.