예제 #1
0
파일: helpers.py 프로젝트: TouK/vumi-go
 def setup_async_vumi_api(self):
     worker_helper = self.get_worker_helper()
     amqp_client = worker_helper.get_fake_amqp_client(worker_helper.broker)
     d = amqp_client.start_publisher(ApiCommandPublisher)
     d.addCallback(lambda cmd_publisher: VumiApi.from_config_async(
         self.mk_config({}), cmd_publisher))
     return d.addCallback(self.set_vumi_api)
예제 #2
0
 def startWorker(self):
     self.vumi_api = yield VumiApi.from_config_async(
         self.config, self._amqp_client)
     self._publishers = {}
     for conv_type in self.SUPPORTED_APPS:
         yield self.make_publisher(conv_type)
     self.WORKER_QUEUE.put(self)
예제 #3
0
 def setup_async_vumi_api(self):
     worker_helper = self.get_worker_helper()
     amqp_client = worker_helper.get_fake_amqp_client(worker_helper.broker)
     d = amqp_client.start_publisher(ApiCommandPublisher)
     d.addCallback(lambda cmd_publisher: VumiApi.from_config_async(
         self.mk_config({}), cmd_publisher))
     return d.addCallback(self.set_vumi_api)
예제 #4
0
파일: jsbox_send.py 프로젝트: TouK/vumi-go
 def startWorker(self):
     self.vumi_api = yield VumiApi.from_config_async(
         self.config, self._amqp_client)
     self._publishers = {}
     for conv_type in self.SUPPORTED_APPS:
         yield self.make_publisher(conv_type)
     self.WORKER_QUEUE.put(self)
예제 #5
0
 def setup_worker(self):
     self.vumi_api = yield VumiApi.from_config_async(self.config)
     config = self.get_static_config()
     self.webserver = self.start_web_resources([
         (AuthorizedResource(self, ConversationApiResource),
          config.web_path),
         (httprpc.HttpRpcHealthResource(self), config.health_path)
     ], config.web_port)
예제 #6
0
파일: app_worker.py 프로젝트: TouK/vumi-go
    def _go_setup_vumi_api(self, config):
        api_config = {
            'riak_manager': config.riak_manager,
            'redis_manager': config.redis_manager,
            }
        d = VumiApi.from_config_async(
            api_config, self.command_publisher, self.metric_publisher)

        def cb(vumi_api):
            self.vumi_api = vumi_api
            self.redis = vumi_api.redis
            self.manager = vumi_api.manager
        return d.addCallback(cb)
예제 #7
0
    def _go_setup_vumi_api(self, config):
        api_config = {
            'riak_manager': config.riak_manager,
            'redis_manager': config.redis_manager,
        }
        d = VumiApi.from_config_async(api_config, self.command_publisher,
                                      self.metric_publisher)

        def cb(vumi_api):
            self.vumi_api = vumi_api
            self.redis = vumi_api.redis
            self.manager = vumi_api.manager

        return d.addCallback(cb)
예제 #8
0
 def setup_worker(self):
     config = self.get_static_config()
     self.vumi_api = yield VumiApi.from_config_async({
         'redis_manager': config.redis_manager,
         'riak_manager': config.riak_manager,
     })
     self.realm = GoUserRealm(self._rpc_resource_for_user)
     site = build_web_site({
         config.web_path: GoUserAuthSessionWrapper(
             self.realm, self.vumi_api),
         config.health_path: httprpc.HttpRpcHealthResource(self),
     })
     self._web_service = StreamServerEndpointService(
         config.twisted_endpoint, site)
     self._web_service.startService()
예제 #9
0
파일: api_worker.py 프로젝트: TouK/vumi-go
    def setup_application(self):
        self.handlers = {}

        self.api_command_publisher = yield self.start_publisher(
            ApiCommandPublisher)
        self.vumi_api = yield VumiApi.from_config_async(
            self.config, self.api_command_publisher)
        self.account_config = {}

        for name, handler_class in self.handler_config.items():
            cls = load_class_by_string(handler_class)
            self.handlers[name] = cls(self, self.config.get(name, {}))
            yield self.handlers[name].setup_handler()

        self.api_event_consumer = yield self.consume(
            ApiEventPublisher.routing_key, self.consume_api_event,
            message_class=VumiApiEvent)
예제 #10
0
    def setup_application(self):
        self.handlers = {}

        self.api_command_publisher = yield self.start_publisher(
            ApiCommandPublisher)
        self.vumi_api = yield VumiApi.from_config_async(
            self.config, self.api_command_publisher)
        self.account_config = {}

        for name, handler_class in self.handler_config.items():
            cls = load_class_by_string(handler_class)
            self.handlers[name] = cls(self, self.config.get(name, {}))
            yield self.handlers[name].setup_handler()

        self.api_event_consumer = yield self.consume(
            ApiEventPublisher.routing_key,
            self.consume_api_event,
            message_class=VumiApiEvent)
예제 #11
0
    def setup_worker(self):
        yield self._go_setup_worker()
        config = self.get_static_config()

        self.vumi_api = yield VumiApi.from_config_async({
            'riak_manager': config.riak_manager,
            'redis_manager': config.redis_manager,
        })
        self.redis = self.vumi_api.redis

        self.command_publisher = yield self.start_publisher(
            ApiCommandPublisher)

        self._current_bucket = 0
        self._num_buckets = (
            config.metrics_interval // config.metrics_granularity)
        self._buckets = dict((i, []) for i in range(self._num_buckets))
        self._conversation_workers = {}

        self._looper = LoopingCall(self.metrics_loop_func)
        self._looper.start(config.metrics_granularity)
예제 #12
0
    def setup_worker(self):
        yield self._go_setup_worker()
        config = self.get_static_config()

        self.vumi_api = yield VumiApi.from_config_async({
            'riak_manager':
            config.riak_manager,
            'redis_manager':
            config.redis_manager,
        })
        self.redis = self.vumi_api.redis

        self.command_publisher = yield self.start_publisher(
            ApiCommandPublisher)

        self._current_bucket = 0
        self._num_buckets = (config.metrics_interval //
                             config.metrics_granularity)
        self._buckets = dict((i, []) for i in range(self._num_buckets))
        self._conversation_workers = {}

        self._looper = LoopingCall(self.metrics_loop_func)
        self._looper.start(config.metrics_granularity)
예제 #13
0
 def startWorker(self):
     self.vumi_api = yield VumiApi.from_config_async(self.config)
     self.WORKER_QUEUE.put(self)
예제 #14
0
 def setup_middleware(self):
     yield super(GoStoringMiddleware, self).setup_middleware()
     self.vumi_api = yield VumiApi.from_config_async(self.config)
예제 #15
0
    def setup_middleware(self):
        self.vumi_api = yield VumiApi.from_config_async(self.config)

        self.case_sensitive = self.config.get('case_sensitive', False)
        keywords = self.config.get('optout_keywords', [])
        self.optout_keywords = set([self.casing(word) for word in keywords])
예제 #16
0
    def setup_middleware(self):
        self.vumi_api = yield VumiApi.from_config_async(self.config)

        self.case_sensitive = self.config.get("case_sensitive", False)
        keywords = self.config.get("optout_keywords", [])
        self.optout_keywords = set([self.casing(word) for word in keywords])
예제 #17
0
 def setup_middleware(self):
     yield super(GoStoringMiddleware, self).setup_middleware()
     self.vumi_api = yield VumiApi.from_config_async(self.config)
예제 #18
0
 def startWorker(self):
     self.vumi_api = yield VumiApi.from_config_async(self.config)
     self.WORKER_QUEUE.put(self)