Use listener pools in designate-sink

configuring pools for notificaiton listeners is an alternative approach
to using per-component notification topics, however not all
oslo.messaging drivers support it (from currently available, zmq and
amqp1 do not, rabbit and kafka do support listener pools).

This patch adds a config option 'listener-pool-name' to [service:sink]
config section (defaults to None) that can be used to configure a common
pool for designate-sink notification listeners if the messaging driver
does support them.

Change-Id: I4fc1c7264671c3102c067beb7298879e62214d60
This commit is contained in:
Pavlo Shchelokovskyy 2018-06-26 17:38:13 +03:00
parent fe60c5b11e
commit 5fdef82a30
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')
def get_listener(targets, endpoints, serializer=None):
def get_listener(targets, endpoints, serializer=None, pool=None):
assert TRANSPORT is not None
if serializer is None:
serializer = JsonPayloadSerializer()
@ -206,6 +206,7 @@ def get_listener(targets, endpoints, serializer=None):
targets,
endpoints,
executor='eventlet',
pool=pool,
serializer=serializer)

View File

@ -26,6 +26,11 @@ OPTS = [
help='Number of sink greenthreads to spawn'),
cfg.ListOpt('enabled-notification-handlers', default=[],
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
# 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:
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.