Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3756682
D999.id2552.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D999.id2552.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D999: Clean up queue if exchange doesn't exist
Attached
Detach File
Event Timeline
Log In to Comment