Skip to content

Commit

Permalink
DM: Graceful cleanup of RabbitMQ message queues when DM stops
Browse files Browse the repository at this point in the history
Delete RMQ message queues when DM receives stop signal, this will ensure
queues gets deleted when DM gets stopped gracefully.

Closes-Bug: #1524548
(cherry picked from commit 239b45e)

Conflicts:
	src/config/common/vnc_kombu.py

Change-Id: Ifc3baccb5fc5d98a76a6b191841ab45d654f330d
  • Loading branch information
sbalineni authored and bfernando committed Jan 26, 2017
1 parent dd95435 commit b365d1c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/config/common/vnc_kombu.py
Expand Up @@ -104,6 +104,17 @@ def _reconnect(self, delete_old_q=False):
self._producer = kombu.Producer(self._channel, exchange=self.obj_upd_exchange)
# end _reconnect

def _delete_queue(self):
# delete the queue
try:
bound_q = self._update_queue_obj(self._channel)
if bound_q:
bound_q.delete()
except Exception as e:
msg = 'Unable to delete the old ampq queue: %s' %(str(e))
self._logger(msg, level=SandeshLevel.SYS_ERR)
#end _delete_queue

def _connection_watch(self, connected):
if not connected:
self._reconnect()
Expand Down Expand Up @@ -174,6 +185,7 @@ def shutdown(self):
self._connection_monitor_greenlet.kill()
self._producer.close()
self._consumer.close()
self._delete_queue()
self._conn.close()

_SSL_PROTOCOLS = {
Expand Down

0 comments on commit b365d1c

Please sign in to comment.