当前位置: 首页>>代码示例>>Python>>正文


Python Channel.start_all_channels方法代码示例

本文整理汇总了Python中junebug.channel.Channel.start_all_channels方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.start_all_channels方法的具体用法?Python Channel.start_all_channels怎么用?Python Channel.start_all_channels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在junebug.channel.Channel的用法示例。


在下文中一共展示了Channel.start_all_channels方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup

# 需要导入模块: from junebug.channel import Channel [as 别名]
# 或者: from junebug.channel.Channel import start_all_channels [as 别名]
    def setup(self, redis=None, message_sender=None):
        if redis is None:
            redis = yield TxRedisManager.from_config(self.redis_config)

        if message_sender is None:
            message_sender = MessageSender(
                'amqp-spec-0-8.xml', self.amqp_config)

        self.redis = redis
        self.message_sender = message_sender
        self.message_sender.setServiceParent(self.service)

        self.inbounds = InboundMessageStore(
            self.redis, self.config.inbound_message_ttl)

        self.outbounds = OutboundMessageStore(
            self.redis, self.config.outbound_message_ttl)

        self.message_rate = MessageRateStore(self.redis)

        self.plugins = []
        for plugin_config in self.config.plugins:
            cls = load_class_by_string(plugin_config['type'])
            plugin = cls()
            yield plugin.start_plugin(plugin_config, self.config)
            self.plugins.append(plugin)

        yield Channel.start_all_channels(
            self.redis, self.config, self.service, self.plugins)
开发者ID:BantouTelecom,项目名称:junebug,代码行数:31,代码来源:api.py

示例2: test_start_all_channels

# 需要导入模块: from junebug.channel import Channel [as 别名]
# 或者: from junebug.channel.Channel import start_all_channels [as 别名]
    def test_start_all_channels(self):
        yield Channel.start_all_channels(
            self.redis, self.config, self.service)

        channel1 = yield self.create_channel(
            self.service, self.redis)
        self.assertTrue(channel1.id in self.service.namedServices)
        yield channel1.stop()
        self.assertFalse(channel1.id in self.service.namedServices)
        yield Channel.start_all_channels(
            self.redis, self.config, self.service)
        self.assertTrue(channel1.id in self.service.namedServices)

        channel2 = yield self.create_channel(
            self.service, self.redis)
        self.assertTrue(channel2.id in self.service.namedServices)
        yield channel2.stop()
        self.assertFalse(channel2.id in self.service.namedServices)
        yield Channel.start_all_channels(
            self.redis, self.config, self.service)
        self.assertTrue(channel1.id in self.service.namedServices)
        self.assertTrue(channel2.id in self.service.namedServices)
开发者ID:BantouTelecom,项目名称:junebug,代码行数:24,代码来源:test_channel.py


注:本文中的junebug.channel.Channel.start_all_channels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。