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


Python EventBus.send_with_timeout方法代码示例

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


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

示例1: deploy_handler

# 需要导入模块: from core.event_bus import EventBus [as 别名]
# 或者: from core.event_bus.EventBus import send_with_timeout [as 别名]
   def deploy_handler(err, id):
       if err is None:
   #        import static_data
           print "loaded " + id
           def bla(reply,r2): print 'bla',reply,r2
           EventBus.send_with_timeout("campudus.jsonvalidator", {
 "action" : "addSchema",
 "key" : "simpleAddSchema",
 "jsonSchema" : {
   "$schema": "http://json-schema.org/draft-04/schema#",
   "title": "Example Schema",
   "type": "object",
   "properties": {
     "firstName": {
       "type": "string"
     },
     "lastName": {
       "type": "string"
     },
       "age": {
         "description": "Age in years",
         "type": "integer",
         "minimum": 0
       }
     },
     "required": ["firstName", "lastName"]
   }
   }, 1000, bla)
           EventBus.send("campudus.jsonvalidator", {"action":"getSchemaKeys"}, bla)
       else:
           print 'Failed to deploy %s' % err
           err.printStackTrace()
开发者ID:stt,项目名称:vertx-trans,代码行数:34,代码来源:app.py

示例2: test_reply_timeout

# 需要导入模块: from core.event_bus import EventBus [as 别名]
# 或者: from core.event_bus.EventBus import send_with_timeout [as 别名]
    def test_reply_timeout(self):
        json = {'message': 'hello world!'}
        address = 'some-address'
        reply = {'cheese': 'stilton!'}
        def handler(msg):
            tu.azzert(msg.body['message'] == json['message'])
        id = EventBus.register_handler(address, handler=handler)
        tu.azzert(id != None)

        def reply_handler(error, msg):
            tu.azzert(error != None)
            EventBus.unregister_handler(id)
            tu.test_complete()
        EventBus.send_with_timeout(address, json, 10, reply_handler)
开发者ID:johnkewforks,项目名称:mod-lang-jython,代码行数:16,代码来源:test_client.py


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