def __init__(self, redis_manager, config, properties, plugins=[], id=None): '''Creates a new channel. ``redis_manager`` is the redis manager, from which a sub manager is created using the channel id. If the channel id is not supplied, a UUID one is generated. Call ``save`` to save the channel data. It can be started using the ``start`` function.''' self._properties = properties self.redis = redis_manager self.id = id self.config = config if self.id is None: self.id = str(uuid.uuid4()) self.options = deepcopy(VumiOptions.default_vumi_options) self.options.update(self.config.amqp) self.transport_worker = None self.application_worker = None self.status_application_worker = None self.sstore = StatusStore(self.redis) self.plugins = plugins self.message_rates = MessageRateStore(self.redis)
def setup_worker(self): redis = yield TxRedisManager.from_config(self.config['redis_manager']) self.store = StatusStore(redis, ttl=None) yield self.unpause_connectors()
def create_store(self): redis = yield self.get_redis() store = StatusStore(redis, ttl=None) returnValue(store)