From afbade30385478885cd8e97f72827425f728e866 Mon Sep 17 00:00:00 2001 From: Brandon Logan Date: Thu, 5 Nov 2015 21:27:01 -0600 Subject: [PATCH] Launch consumer without calling oslo messaging wait Oslo messaging RPCServers should not be launched to receive messages by calling the wait method. The wait method is meant to be called after stop to finish processing messages that were on the queue before the stop method was called. Instead this uses oslo_service to launch the RPCServer. Change-Id: I5aa4b0f349b26b523bd9853f2a2cd239c2991ea9 Closes-Bug: #1513689 --- octavia/controller/queue/consumer.py | 9 ++++++--- requirements.txt | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/octavia/controller/queue/consumer.py b/octavia/controller/queue/consumer.py index abd27d7205..85bce2b437 100644 --- a/octavia/controller/queue/consumer.py +++ b/octavia/controller/queue/consumer.py @@ -15,6 +15,7 @@ from oslo_config import cfg from oslo_log import log as logging import oslo_messaging as messaging +from oslo_service import service from octavia.controller.queue import endpoint from octavia.i18n import _LI @@ -36,10 +37,12 @@ class Consumer(object): def listen(self): try: - self.server.start() + service.launch(cfg.CONF, self.server).wait() LOG.info(_LI('Consumer is now listening...')) - self.server.wait() finally: LOG.info(_LI('Stopping consumer...')) self.server.stop() - LOG.info(_LI('Consumer successfully stopped.')) + LOG.info(_LI('Consumer successfully stopped. Waiting for final ' + 'messages to be processed...')) + self.server.wait() + LOG.info(_LI('Finished waiting.')) diff --git a/requirements.txt b/requirements.txt index 6cc680a929..e88552e40c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,6 +26,7 @@ oslo.messaging!=1.17.0,!=1.17.1,!=2.6.0,!=2.6.1,>=1.16.0 # Apache-2.0 oslo.middleware>=2.8.0 # Apache-2.0 oslo.rootwrap>=2.0.0 # Apache-2.0 oslo.serialization>=1.10.0 # Apache-2.0 +oslo.service>=0.11.0 # Apache-2.0 oslo.utils!=2.6.0,>=2.4.0 # Apache-2.0 PyMySQL>=0.6.2 # MIT License python-barbicanclient>=3.3.0