You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document the new `x-cc` message annotation as introduced in RabbitMQ 4.1
via rabbitmq/rabbitmq-server#12559
Rewrite AMQP 0.9.1 docs since they didn't make sense.
Copy file name to clipboardExpand all lines: docs/sender-selected.md
+25-29Lines changed: 25 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,33 +20,29 @@ limitations under the License.
20
20
21
21
# Sender-selected Distribution
22
22
23
+
An AMQP publisher can optionally send a message with **multiple** routing keys.
24
+
During routing, RabbitMQ will take all routing keys provided in the message headers into account.
23
25
24
-
The routing logic in AMQP 0-9-1 does not offer a way for message
25
-
[publishers](./publishers) to select intended recipients unless they
26
-
bind their queues to the target destination (an exchange).
27
-
28
-
The RabbitMQ broker treats the "CC" and "BCC" message headers
29
-
in a special way to overcome this limitation.
30
-
This is the equivalent of entering multiple recipients in the "CC"
31
-
or "BCC" field of an email.
32
-
33
-
The values associated with the "CC" and "BCC" header keys will
34
-
be added to the routing key if they are present. The message
35
-
will be routed to all destinations matching the routing key
36
-
supplied as a parameter to the `basic.publish`
37
-
method, as well as the routes supplied in the "CC" and "BCC"
38
-
headers. The type of "CC" and "BCC" values must be an array
39
-
of [longstr](/amqp-0-9-1-reference#domain.longstr)
40
-
and these keys are case-sensitive. If the header does not
41
-
contain "CC" or "BCC" keys then this extension has no effect.
42
-
43
-
The "BCC" key and value will be removed from the message
44
-
prior to delivery, offering some confidentiality among
45
-
consumers. This feature is a deviation from the AMQP 0-9-1
46
-
specification which forbids any message modification,
47
-
including headers. This feature imposes a small
48
-
performance penalty.
49
-
50
-
This extension is independent of the client library used.
51
-
Any AMQP 0-9-1 client with the ability to set header values
52
-
at the time of publishing can make use of this extension.
26
+
For example, if an AMQP publisher sends a message with multiple routing keys to the [default exchange](/tutorials/amqp-concepts#exchange-default), each routing key represents a queue name, and RabbitMQ routes the message to all specified queues.
27
+
28
+
In another example, if an AMQP publisher sends a message with multiple routing keys to a [topic exchange](/tutorials/amqp-concepts#exchange-topic), each routing key represents a topic.
29
+
30
+
Including multiple routing keys in a message allows it to be routed to more queues, depending on how the queues are bound to the exchange.
31
+
RabbitMQ settles the message with the [accepted](./amqp#outcomes) outcome if it is routed to at least one queue and all queues confirm receipt.
32
+
In other words, RabbitMQ accepts the message even if only a subset of the routing keys results in successful routing.
33
+
34
+
## AMQP 1.0
35
+
36
+
To use multiple routing keys in AMQP 1.0, the publisher sets a [message annotation](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-message-annotations) with the key `x-cc` and the value as an [array](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html#type-array) of [strings](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html#type-string).
37
+
Each string in the array represents an additional routing key.
38
+
39
+
These "CC" routing keys are used in addition to the routing key provided in the [AMQP address](./amqp#target-address-v2) string.
40
+
41
+
## AMQP 0.9.1
42
+
43
+
To use multiple routing keys in AMQP 0.9.1, the publisher sets the "CC" and "BCC" header keys.
44
+
This is similar to specifying multiple recipients in the "CC" or "BCC" fields of an email.
45
+
The value for "CC" and "BCC" must be an array of [longstr](/amqp-0-9-1-reference#domain.longstr).
46
+
47
+
The message will be routed using both the routing key supplied as a parameter to the `basic.publish` method and the routing keys provided in the "CC" and "BCC" headers.
48
+
The "BCC" key and value will be removed from the message prior to delivery, ensuring some level of confidentiality among consumers.
0 commit comments