@@ -23,10 +23,19 @@ limitations under the License.
2323## Overview {#overview}
2424
2525Direct reply-to is a feature that allows RPC (request/reply) clients with a design
26- similar to that demonstrated in [ tutorial 6] ( /tutorials ) to avoid
27- declaring a response queue per request .
26+ similar to that demonstrated in [ tutorial 6] ( /tutorials ) without requiring the creation
27+ of a reply queue.
2828
29- ### Motivation {#motivation}
29+ ::: important
30+
31+ Request-reply implementations where clients use explicitly declared queues, both
32+ long-lived client named and connection-specific exclusive queues, are
33+ just as valid as Direct Reply-to, and have their benefits, in particular
34+ for workloads with long-running tasks
35+
36+ :::
37+
38+ ## Motivation {#motivation}
3039
3140RPC (request/reply) is a popular pattern to implement with a messaging broker
3241like RabbitMQ. [ Tutorial 6] ( /tutorials ) demonstrates its implementation
@@ -38,22 +47,26 @@ header.
3847
3948Where does the client's queue come from? The client can
4049declare a single-use queue for each request-response pair. But
41- this is inefficient; even a transient unreplicated queue can be
50+ this is inefficient; even an unreplicated queue can be
4251expensive to create and then delete (compared with the cost of
4352sending a message). This is especially true in a cluster as all
4453cluster nodes need to agree that the queue has been created,
4554agree on its type, replication parameters, and other metadata.
4655
47- So alternatively the client can create a long-lived queue for
48- its replies. But this can be fiddly to manage, especially if the
49- client itself is not long-lived.
56+ Therefore, the client should create a single reply queue for multiple RPC requests.
57+
58+ The [ properties ] ( queues#properties ) of this reply queue depend on the use case:
5059
51- The direct reply-to feature allows RPC clients to receive
52- replies directly from their RPC server, without going through a
53- reply queue. "Directly" here still means going through the same connection
54- and a RabbitMQ node; there is no direct network connection
55- between RPC client and RPC server processes.
60+ * ** [ Exclusive] ( queues#exclusive-queues ) queues** are commonly used when replies are consumed by a single client and deleted upon disconnection
61+ * ** Non-exclusive long-lived queues** are better suited for long-running tasks, ensuring replies persist even if the client disconnects temporarily
5662
63+ Direct reply-to eliminates the need for a reply queue. This benefits the request-reply
64+ implementations with short-lived queues and transient responses at the cost
65+ of giving up all control over how the responses are stored.
66+
67+ With Direct Reply-to, RPC clients will receive replies directly from their RPC server,
68+ without going through a reply queue. "Directly" here still means going through the same channel
69+ and a RabbitMQ node; there is no direct network connection between RPC client and RPC server processes.
5770
5871## How to Use Direct Reply-to {#usage}
5972
@@ -123,3 +136,16 @@ or fail.
123136 was set.
124137 </li >
125138</ul >
139+
140+ ## When to Use Direct Reply-to
141+
142+ While clients should use long lived connections, direct reply-to is ideal for workloads with
143+ [ high connection churn] ( connections#high-connection-churn ) , where clients establish a connection
144+ for a single RPC and disconnect immediately after.
145+ By avoiding the creation of queue metadata in the [ metadata store] ( metadata-store ) , direct
146+ reply-to can reduce overhead and latency.
147+
148+ For workloads with long-lived connections where clients perform multiple RPCs, the performance
149+ benefits of direct reply-to are not significant compared to [ classic queues] ( classic-queues ) .
150+ Modern RabbitMQ versions have optimized classic queues for low latency and minimal resource usage,
151+ making them similarly efficient in such scenarios.
0 commit comments