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
Change-Id: Ifc3baccb5fc5d98a76a6b191841ab45d654f330d
  • Loading branch information
sbalineni committed Feb 12, 2016
1 parent 014e76f commit 239b45e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/config/common/vnc_kombu.py
Expand Up @@ -111,6 +111,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 @@ -181,9 +192,9 @@ def shutdown(self):
self._connection_monitor_greenlet.kill()
self._producer.close()
self._consumer.close()
self._delete_queue()
self._conn.close()


class VncKombuClientV1(VncKombuClientBase):
def __init__(self, rabbit_ip, rabbit_port, rabbit_user, rabbit_password,
rabbit_vhost, rabbit_ha_mode, q_name, subscribe_cb, logger):
Expand Down

0 comments on commit 239b45e

Please sign in to comment.