Page MenuHomeDevCentral

D999.id2552.diff
No OneTemporary

D999.id2552.diff

diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -131,9 +131,21 @@
channel = connection.channel()
channel.queue_declare(durable=True,
queue=queue_name)
- channel.queue_bind(exchange=exchange_name,
- queue=queue_name,
- routing_key=routing_key)
+ try:
+ channel.queue_bind(exchange=exchange_name,
+ queue=queue_name,
+ routing_key=routing_key)
+ except pika.exceptions.ChannelClosed as err:
+ # We've created a queue but we can't use it,
+ # so let's try to delete it through a new connection.
+ try:
+ print("Deleting unused queue: {0}".format(queue_name))
+ delete_broker_queue(queue_name, True)
+ except pika.exceptions.ChannelClosed:
+ pass
+
+ raise err
+
connection.close(reply_text="Operation done")
return queue_key
@@ -189,7 +201,9 @@
if not request.json:
abort(400)
+ print("Let's determine the exchange", file=sys.stderr)
exchange_name = get_exchange_from_request()
+ print("Exchange is " + exchange_name, file=sys.stderr)
routing_key = get_variable_from_request("routing-key", "*")
# Handles request

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 02:20 (21 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2253210
Default Alt Text
D999.id2552.diff (1 KB)

Event Timeline