Addresses
An address names a node in the broker, and the capability a receiver asks for decides whether its receivers share a queue or each get a copy.
The diagram as text
- Address orders: anycast: Queue orders each message once
- Address events: multicast: Subscription queue of receiver 1; Subscription queue of receiver 2
- Dynamic source: Receiver dynamic = true; Temporary queue named by the broker
- Queue orders each message once → Receiver 1 capability queue: message 1
- Queue orders each message once → Receiver 2 capability queue: message 2
- Subscription queue of receiver 1 → Receiver 1 capability topic: every message
- Subscription queue of receiver 2 → Receiver 2 capability topic: every message
- Receiver dynamic = true → Temporary queue named by the broker: attach
- Temporary queue named by the broker → Receiver dynamic = true: address
A receiver attaches with a source terminus: the address of a node and a list of capabilities.
AmqpAddress::queue asks for the capability queue,
AmqpAddress::topic for topic, and
AmqpAddress::raw for none.
ActiveMQ Artemis reads the capability. With queue, the receivers of an address attach to one
anycast queue and compete: each message goes to one of them. With topic, the address is
multicast and Artemis gives each receiver a subscription queue of its own, so each receives every
message. Artemis creates an address and its queues on the first attach unless its settings forbid
it, and orders::billing names one queue of an address directly.
A topic subscription keeps the terminus defaults of the specification: not durable, and expiring with its session. Its subscription queue lives as long as the link, so what is published to the topic while the service is stopped is not kept for it.
A raw address reaches the broker exactly as written, and the broker's own configuration decides
what it is. Other brokers address their nodes in their own way:
RabbitMQ 4 names a queue /queues/orders and an exchange
/exchanges/events/key, and the queue must exist beforehand.
Azure Service Bus
names a queue by its name and a topic subscription events/subscriptions/billing.
A receiver may ask for a dynamic source instead of naming one. The broker then creates a node,
Artemis a temporary queue, and returns its address in its answer to the attach.
request attaches one such receiver for every request,
sends the address in reply-to, and detaches the receiver when the reply has arrived or the timeout
has passed.
The terminus fields are the specification's (messaging, section 3.5), and the address model is Artemis's (AMQP, address model).