python调用dubbo,目前支持dubbo协议,不需要服务端修改成jsonrpc.实现客户端的负载均衡、配合Zookeeper自动发现服务功能等
Project description
python调用dubbo,目前支持dubbo协议,不需要服务端修改成jsonrpc.实现客户端的负载均衡、配合Zookeeper自动发现服务功能等 依赖pyhessian,bitstring
示例代码
from pydubbo.pydubbo import DubboZK
if __name__ == '__main__':
d = DubboZK(interface="com.dianwoba.genius.provider.StaffProvider", hosts='192.168.11.29:2185')
res = d.findByCode([("Ljava/lang/String;", u"00064")]) #根据返回的方法,动态添加.输入的参数只有一个java string类型
print(res, res.data)#(<com.dianwoba.dubbo.base.result.ResponseDTO object at 0x1035d2a50>, <com.dianwoba.genius.domain.dto.StaffDTO object at 0x1035d2ad0>)
res = d.findByMobile([("Ljava/lang/String;", u"18657112153")]) #根据返回的方法,动态添加.输入的参数只有一个java string类型
print(res.data.name)
具体参照测test目录,目前支持常用的dubbo协议。
1.dubbo协议
1.1 请求头
intbe:16=-9541,intbe:8=-62,intbe:8=0,uintbe:64=0,uintbe:32=数据包长度
总长度16字节。
依次是2字节的magic信息 ,一个字节的附加信息 ,一个字节的空信息,8个字节的空信息,4个字节的数据包长度
1.2 信息体
通过hessian协议序列化的二进制信息
1.3 响应头
intbe:16,intbe:8,intbe:8,uintbe:64,uintbe:32
总长度16个字节
依次是2字节的magic信息 ,一个字节的附加信息 ,一个字节的空信息,8个字节的空信息,4个字节的数据包长度
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydubbo-0.1.1.tar.gz.
File metadata
- Download URL: pydubbo-0.1.1.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7b43fa38566b7404e8e7504e8fa18a813be79c75059efda0b233e81df351a2d
|
|
| MD5 |
0a692a9b5d5e88b1281628761d083790
|
|
| BLAKE2b-256 |
287049debd75ab060261bb6b8d92e848bbee7f3d36c180d3a37d0fe39ef23285
|
File details
Details for the file pydubbo-0.1.1-py2-none-any.whl.
File metadata
- Download URL: pydubbo-0.1.1-py2-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2de7165f6368ae6b17f9bcedcb25c0038f3a0b06a4e7e977524d5be7118ecf49
|
|
| MD5 |
66748bd34525d3d9b805a0d322b9e59f
|
|
| BLAKE2b-256 |
aa7723de76c6ccf023bec0eb254deb00ea89a0f9eb56ffc8e06f4b5f8ace4378
|