diff --git a/designate/rpc.py b/designate/rpc.py index e1ed5d8ea..8702f442c 100644 --- a/designate/rpc.py +++ b/designate/rpc.py @@ -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) diff --git a/designate/sink/__init__.py b/designate/sink/__init__.py index adf4c2c51..c6557cfc6 100644 --- a/designate/sink/__init__.py +++ b/designate/sink/__init__.py @@ -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.'), ] diff --git a/designate/sink/service.py b/designate/sink/service.py index d8341c845..90db96db0 100644 --- a/designate/sink/service.py +++ b/designate/sink/service.py @@ -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() diff --git a/releasenotes/notes/pool-listener-6689ffa50345ba6e.yaml b/releasenotes/notes/pool-listener-6689ffa50345ba6e.yaml new file mode 100644 index 000000000..56f9216ee --- /dev/null +++ b/releasenotes/notes/pool-listener-6689ffa50345ba6e.yaml @@ -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 `_ + 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.