notif: Check the driver features in dispatcher

The transport/driver features check is done into the get listener
methods.
So when these methods are not used the driver features checks is not
done.

This change moves it into the dispatcher layer to ensure the
requirements are always checked.

This changes a bit the behavior of when the check occurs. Before
it was during the listener object initialisation. Now this
when the listener server start.

Change-Id: I4d81a4e8496f04d62e48317829d5dd8b942d501c
This commit is contained in:
Mehdi Abaakouk 2015-12-01 10:27:23 +01:00
parent 4dd644ac20
commit 185f94c013
2 changed files with 1 additions and 2 deletions

View File

@ -56,6 +56,7 @@ class _NotificationDispatcherBase(dispatcher.DispatcherBase):
priorities)) priorities))
def _listen(self, transport): def _listen(self, transport):
transport._require_driver_features(requeue=self.allow_requeue)
return transport._listen_for_notifications(self._targets_priorities, return transport._listen_for_notifications(self._targets_priorities,
pool=self.pool) pool=self.pool)

View File

@ -137,7 +137,6 @@ def get_notification_listener(transport, targets, endpoints,
:type pool: str :type pool: str
:raises: NotImplementedError :raises: NotImplementedError
""" """
transport._require_driver_features(requeue=allow_requeue)
dispatcher = notify_dispatcher.NotificationDispatcher(targets, endpoints, dispatcher = notify_dispatcher.NotificationDispatcher(targets, endpoints,
serializer, serializer,
allow_requeue, pool) allow_requeue, pool)
@ -180,7 +179,6 @@ def get_batch_notification_listener(transport, targets, endpoints,
:type batch_timeout: int :type batch_timeout: int
:raises: NotImplementedError :raises: NotImplementedError
""" """
transport._require_driver_features(requeue=allow_requeue)
dispatcher = notify_dispatcher.BatchNotificationDispatcher( dispatcher = notify_dispatcher.BatchNotificationDispatcher(
targets, endpoints, serializer, allow_requeue, pool, targets, endpoints, serializer, allow_requeue, pool,
batch_size, batch_timeout) batch_size, batch_timeout)