tree: d80e16f3a08f8dde01afab0a39723754397e426c [path history] [tgz]
  1. .gitignore
  2. README.md
  3. dubbo_client/
  4. test_dubbo_client/
  5. version.txt
README.md

Python Dubbo Client

实现客户端的负载均衡、自动发现服务功能

Python调用Dubbo接口的jsonrpc协议

请使用dubbo-rpc-jsonrpc 并在dubbo中配置protocol为jsonrpc协议

在客户端实现负载均衡,服务发现

通过注册中心的zookeeper,获取服务的注册信息 然后通过代理实现负载均衡算法,调用服务端

Example

    service_interface = 'com.ofpay.demo.api.UserProvider'
    registry = ZookeeperRegistry('172.19.65.33:2181')
    dubbo_client = DubboClient(service_interface, registry)
    for i in range(1000):
        try:
            print dubbo_client.getUser('A003')
            print dubbo_client.queryUser(
                {u'age': 18, u'time': 1428463514153, u'sex': u'MAN', u'id': u'A003', u'name': u'zhangsan'})
            print dubbo_client.queryAll()
            print dubbo_client.isLimit('MAN', 'Joe')
            print dubbo_client('getUser', 'A005')

        except DubboClientError, client_error:
            print client_error
        time.sleep(5)