Endpoints and Queues
Guaranteed messages are stored in event broker endpoints. There are two types of endpoints: queues and topic endpoints. In most scenarios the queue endpoint is a superset of the topic endpoint, and is the endpoint most commonly used. Topic endpoints are used by JMS (that is, durable topic subscriptions).
Queues on an event broker work very much like queues in all message queuing systems. Producers send guaranteed messages to the event broker. These messages are saved in the queue, and delivered to consuming clients if they are online and connected. The consumer acknowledges the message once it has completed processing it, and then the message is then removed from event broker's queue. Queue objects are highly configurable with a variety of options to tailor their behavior to application needs.
Queues' lifecycles are determined by whether they are durable or non-durable. Durable queues remain around permanently until removed through configuration. They accumulate messages when clients are online or offline. When offline clients reconnect, they receive all the messages that were accumulated while they were offline. Temporary queues follow the lifecycle of the client connection, and are useful for ensuring message persistence while clients are online. These temporary queues and topic endpoints are non-durable because they only last as long as the client’s session is connected. If a client disconnects for a certain period of time, the event broker will automatically remove the temporary queues. So messages will not accumulate while clients are offline.
For further information refer to Guaranteed Messages.
In addition to spooling published Guaranteed messages that have a matching queue destination, it's possible to add one or more topic subscriptions to a durable queue so that Guaranteed messages published to those topics are also delivered to and spooled by the queue. This feature enables queues to participate equally in point-to-point and publish/subscribe messaging models, opening up a large number of interesting use cases.
As shown in the following figure, topic-to-queue mapping allows a single message published to a topic to be delivered to a combination of one or more topic endpoints, queues, or even clients with matching Direct Messaging topic subscriptions.
Any Guaranteed messages published to topics that match subscriptions associated with queues are delivered to those queues. Error indications are returned to the publisher if the message can't be delivered to one or more queues for any reason (that is, the feedback to the publisher is identical to that provided when the messages are published directly to the queues).
Topic subscription to queue mappings are applicable to both durable and non‑durable queues. Deletion of a queue for any reason results in the deletion of all topic subscription to queue mappings for that queue.
For further information refer to Adding Topic Subscriptions to Queues.