Coder Social home page Coder Social logo

pydubbo's Introduction

PyDubbo

这是一个python实现的dubbo服务调用的客户端

协议支持

由于dubbo支持多种协议扩展,目前只开发了dubbo服务的默认协议:dubbo+hessian2的支持 其它协议的支持慢慢来吧

安装

运行环境

由于dubbo协议的限制,所以进行远程调用需要接口的参数类型列表,所以客户端需要读取dubbo接口的java class文件来获取参数类型列表

示例

    config = { 'classpath' : '%classpath%' }
    client = Dubbo((('localhost', 20880),), config)
    remoteService = client.getProxy('com.test.RemoteService')

    print remoteService.getTestInfo(123)

Java Object 相关

接口输入输出需要Java Class时,使用Object的实例

config 参考

Dubbo对象的config参数包含的内容比较丰富,目前支持的配置如下:

owner

指定dubbo client的所有者

customer

指定dubbo client名字

classpath

指定dubbo远程接口对应的java class所在的路径,以冒号或者分号分隔 可以支持jar格式 该参数可以不指定,改为通过环境变量"PD_CLASSPATH"来指定,config的优先级高于环境变量

reference

为一个dict,包含每一个具体接口的详细配置 'interfaceName' : referenceConfig

referenceConfig 参考

async

该接口是否异步调用,调用示例: remoteService.getTestInfo(123) future1 = RpcContext.future remoteService.getTestInfo(124) future2 = RpcContext.future

    result1 = future1.get()
    result2 = future2.get()

withReturn

该接口是否需要等待返回值,如果为False则不等待接口返回。

method

为一个dict,包含接口中每一个方法的具体配置 'methodName' : methodConfig

timeout

接口调用超时时间, 单位秒,可以为浮点数

methodConfig 参考

async

同 referenceConfig 的async

withReturn

同 referenceConfig 的withReturn

timeout

同 referenceConfig 的timeout

pydubbo's People

Contributors

zhouyougit avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.