@@ -135,7 +135,7 @@ choose a random queue name for us. We can do it by not supplying the
135
135
At that point ` result.queue ` contains a random queue name. For example it
136
136
may look like ` amq.gen-U0srCoW8TsaXjNh73pnVAw== ` .
137
137
138
- Secondly, once we disconnect the client the queue should be
138
+ Secondly, once we disconnect the consumer the queue should be
139
139
deleted. There's an ` auto_delete ` flag for that:
140
140
141
141
<div ><pre ><code class =' python ' >result = channel.queue_declare(auto_delete=True)</code ></pre ></div >
@@ -242,14 +242,29 @@ pika.asyncore_loop()</code></pre></div>
242
242
243
243
We're done. If you want to save logs to a file, just open a console and type:
244
244
245
- $ ./ receive_logs.py > logs_from_rabbit.log
245
+ $ python receive_logs.py > logs_from_rabbit.log
246
246
247
247
If you wish to see the logs on your screen, spawn a new terminal and run:
248
248
249
- $ ./ receive_logs.py
249
+ $ python receive_logs.py
250
250
251
251
And of course, to emit logs type:
252
252
253
- $ ./ emit_log.py
253
+ $ python emit_log.py
254
254
255
255
256
+ Using ` rabbitmqctl list_bindings ` you can verify if the code actually
257
+ creates bindings and queues as we wanted. With two ` receive_logs.py `
258
+ programs running you should see something like:
259
+
260
+ $ sudo rabbitmqctl list_bindings
261
+ Listing bindings ...
262
+ ...
263
+ logs amq.gen-TJWkez28YpImbWdRKMa8sg== []
264
+ logs amq.gen-x0kymA4yPzAT6BoC/YP+zw== []
265
+ ...done.
266
+
267
+ The interpretation of the result is straightforward: data from
268
+ exchange ` logs ` goes to two queues with server-assigned names. And
269
+ that's exactly what we intended.
270
+
0 commit comments