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_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
vxinaay_xnrpc-1.2.2.tar.gz
(9.6 kB
view hashes)
Built Distribution
Close
Hashes for vxinaay_xnrpc-1.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af74968d1fcf9e070348bd10e1638cdbf4673ab0f19d13a6e5a8ecb5dbf70a9d |
|
MD5 | c4aae1679f845e62c4590e8f560c4743 |
|
BLAKE2b-256 | e6cfe10a0f758287a213051e379b43dc88e99ab147d4853ab1266fb0174df9c1 |