Merge "Use listener pools in designate-sink"

This commit is contained in:
Zuul 2018-07-03 16:09:23 +00:00 committed by Gerrit Code Review
commit 816c99235f
4 changed files with 25 additions and 2 deletions

View File

@ -198,7 +198,7 @@ def get_server(target, endpoints, serializer=None):
TRANSPORT, target, dispatcher, 'eventlet') TRANSPORT, target, dispatcher, 'eventlet')
def get_listener(targets, endpoints, serializer=None): def get_listener(targets, endpoints, serializer=None, pool=None):
assert TRANSPORT is not None assert TRANSPORT is not None
if serializer is None: if serializer is None:
serializer = JsonPayloadSerializer() serializer = JsonPayloadSerializer()
@ -206,6 +206,7 @@ def get_listener(targets, endpoints, serializer=None):
targets, targets,
endpoints, endpoints,
executor='eventlet', executor='eventlet',
pool=pool,
serializer=serializer) serializer=serializer)

View File

@ -26,6 +26,11 @@ OPTS = [
help='Number of sink greenthreads to spawn'), help='Number of sink greenthreads to spawn'),
cfg.ListOpt('enabled-notification-handlers', default=[], cfg.ListOpt('enabled-notification-handlers', default=[],
help='Enabled Notification Handlers'), help='Enabled Notification Handlers'),
cfg.StrOpt('listener-pool-name',
help='pool name to use for oslo.messaging '
'notification listener. '
'Note that listener pooling is not supported '
'by all oslo.messaging drivers.'),
] ]

View File

@ -68,7 +68,9 @@ class Service(service.Service):
# TODO(ekarlso): Change this is to endpoint objects rather then # TODO(ekarlso): Change this is to endpoint objects rather then
# ourselves? # ourselves?
self._server = rpc.get_listener(targets, [self]) self._server = rpc.get_listener(
targets, [self],
pool=cfg.CONF['service:sink'].listener_pool_name)
if len(targets) > 0: if len(targets) > 0:
self._server.start() self._server.start()

View File

@ -0,0 +1,15 @@
---
features:
- |
Designate-Sink service now supports notification listener pooling
for those oslo.messaging drivers that support this feature
(currently those are ``rabbit``/``kombu`` and ``kafka``).
`Listener pools <https://docs.openstack.org/oslo.messaging/latest/reference/notification_listener.html>`_
is an alternative to specifying several topics for notification consumers
in configuration of service that emits notifications.
To enable listener pooling, set the option
``[service:sink]listener_pool_name`` to some string value, that must be the
same for all designate-sink service instances.
Default value of this option (``None``) disables notification listener
pooling.