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
This commit is contained in:
parent
a5fc847427
commit
afbade3038
|
@ -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.'))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue