simple rpc based on zerorpc and gevent
Project description
xnrpc
xnrpc is a light-weight, reliable and language-agnostic library for distributed communication between server-side processes. It builds on top of zerorpc and gevent, simple ,efficient and robust.
features
support heartbeat and timeout
graceful exceptions handler
support pipeline commands
asynchronous I/O, support large concurrency
very simple to use
demo
a simple server and client example:
from xnrpc.server import RpcInterface, ServerManager
from xnrpc.client import open_client
from xnrpc.common.log import get_log
_log = get_log(__name__)
class OperationRpcInterface(RpcInterface):
def ls_file(self):
_log.info('Operation ls file')
return None
def check_ip(self):
_log.info('Operation check ip')
return None
if __name__ == '__main__':
# 启动RPC服务器
rpc_interface = OperationRpcInterface
url = 'tcp://127.0.0.1:7772'
server = ServerManager(url, rpc_interface, name='Test Server')
server.start()
# 建立一个客户端连接
with open_client(url) as client:
client.ls_file()
client.check_ip()
# 停止服务器
server.stop()
Resources
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
xnrpc-1.2.2.tar.gz
(9.1 kB
view details)
Built Distribution
xnrpc-1.2.2-py2-none-any.whl
(12.6 kB
view details)
File details
Details for the file xnrpc-1.2.2.tar.gz
.
File metadata
- Download URL: xnrpc-1.2.2.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95750f72b4877ba7c7afacca1439ef4c75727ac3c24081cf4aa3de7fe530a869 |
|
MD5 | a38b2cd14bf2ab7790a567df1abe9a1c |
|
BLAKE2b-256 | ff45ff5bcf7eb21697f4ba6f5c6a0c3ab9de58a19d7a976cacdfd394727dcb21 |
File details
Details for the file xnrpc-1.2.2-py2-none-any.whl
.
File metadata
- Download URL: xnrpc-1.2.2-py2-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea539ffd7e1d9a7ec1ee754297b614a683db1e8c426e56950e75efd6a012c1f8 |
|
MD5 | a0e66c23a8476b3f2498569390a742b4 |
|
BLAKE2b-256 | f7d9b75199d8c8de6895a896caf76bacb6bcfc0e09b5d71871e8b0aa5de4f787 |