Skip to content

Commit 35ff792

Browse files
committed
documentation [skip ci]
Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent f8b5f54 commit 35ff792

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

examples/rpc/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
RPC example
2+
===
3+
4+
This example demonstrates how to set up a simple RPC (Remote Procedure Call) server and client using [Direct reply to feature](https://www.rabbitmq.com/docs/direct-reply-to).
5+
The example is very basic the correlation id is set but not used to match responses to requests.
6+
7+
Setup
8+
---
9+
10+
To run this example, you need to have RabbitMQ >=4.2 server running locally.
11+
Then run the python scripts in separate terminal windows.
12+
```bash
13+
$ python3 server.py
14+
connection_consumer to amqp server
15+
Responder listening on address: /queues/rpc_queue
16+
```
17+
18+
Then in another terminal window run:
19+
```bash
20+
$ python3 client.py
21+
connection_consumer to amqp server
22+
connected both publisher and consumer
23+
consumer reply address is /queues/amq.rabbitmq.reply-to.g1h2AA5yZXBseUA2ODc4MTMzNAAAcEoAAAAAaS8eQg%3D%
24+
```
25+
26+
The `rpc_queue` is the queue where the server listens for incoming RPC requests.</br>
27+
The `amq.rabbitmq.reply-to.g1h2AA...` is a special direct-reply-to queue used by the client to receive responses.
28+
29+
Use standard queues for reply
30+
===
31+
32+
If you want to use standard queues for replies instead of the direct-reply-to feature.

0 commit comments

Comments
 (0)