Beispiel #1
0
 def message_controller(self):
     stages = _get_builtin_entry_points('message', self._storage,
                                        self.control_driver)
     kwargs = {
         'subscription_controller': self._storage.subscription_controller
     }
     stages.extend(_get_storage_pipeline('message', self.conf, **kwargs))
     stages.append(self._storage.message_controller)
     return common.Pipeline(stages)
Beispiel #2
0
 def message_controller(self):
     stages = _get_builtin_entry_points('message', self._storage,
                                        self.control_driver, self.conf)
     kwargs = {
         'subscription_controller': self._storage.subscription_controller,
         'max_notifier_workers':
         self.conf.notification.max_notifier_workers,
         'require_confirmation': self.conf.notification.require_confirmation
     }
     stages.extend(_get_storage_pipeline('message', self.conf, **kwargs))
     stages.append(self._storage.message_controller)
     return common.Pipeline(stages)
Beispiel #3
0
def _get_storage_pipeline(resource_name, conf):
    """Constructs and returns a storage resource pipeline.

    This is a helper function for any service supporting
    pipelines for the storage layer. The function returns
    a pipeline based on the `{resource_name}_pipeline`
    config option.

    Stages in the pipeline implement controller methods
    that they want to hook. A stage can halt the
    pipeline immediate by returning a value that is
    not None; otherwise, processing will continue
    to the next stage, ending with the actual storage
    controller.

    :param conf: Configuration instance.
    :type conf: `cfg.ConfigOpts`

    :returns: A pipeline to use.
    :rtype: `Pipeline`
    """
    conf.register_opts(_PIPELINE_CONFIGS, group=_PIPELINE_GROUP)

    storage_conf = conf[_PIPELINE_GROUP]

    pipeline = []
    for ns in storage_conf[resource_name + '_pipeline']:
        try:
            mgr = driver.DriverManager('zaqar.queues.storage.stages',
                                       ns,
                                       invoke_on_load=True)
            pipeline.append(mgr.driver)
        except RuntimeError as exc:
            LOG.warning(_(u'Stage %(stage)d could not be imported: %(ex)s'), {
                'stage': ns,
                'ex': str(exc)
            })
            continue

    return common.Pipeline(pipeline)
Beispiel #4
0
 def subscription_controller(self):
     stages = _get_storage_pipeline('subscription', self.conf)
     stages.append(self._storage.subscription_controller)
     return common.Pipeline(stages)
Beispiel #5
0
 def claim_controller(self):
     stages = _get_storage_pipeline('claim', self.conf)
     stages.append(self._storage.claim_controller)
     return common.Pipeline(stages)
Beispiel #6
0
 def message_controller(self):
     stages = _get_storage_pipeline('message', self.conf)
     stages.append(self._storage.message_controller)
     return common.Pipeline(stages)
Beispiel #7
0
 def subscription_controller(self):
     stages = _get_builtin_entry_points('subscription', self._storage,
                                        self.control_driver, self.conf)
     stages.extend(_get_storage_pipeline('subscription', self.conf))
     stages.append(self._storage.subscription_controller)
     return common.Pipeline(stages)
Beispiel #8
0
 def claim_controller(self):
     stages = _get_builtin_entry_points('claim', self._storage,
                                        self.control_driver, self.conf)
     stages.extend(_get_storage_pipeline('claim', self.conf))
     stages.append(self._storage.claim_controller)
     return common.Pipeline(stages)