A dumb as hell rpc implementation built on rabbitmq
Project description
Mause RPC
A dumb as hell rpc implementation built on rabbitmq
Need to write a server?
from mause_rpc.server import Server
rpc_queue = 'rpc.queue'
server = Server(rpc_queue, 'rabbitmq://...')
@server.register
def hello(name:str) -> str:
return 'hello ' + name
@server.register
def div(a:int, b: int):
if b == 0:
raise ZeroDivisionError()
return a / b
if __name__ == '__main__':
server.serve()
Need a client?
from mause_rpc.client import get_client
rpc_queue = 'rpc.queue'
client = get_client(rpc_queue, 'rabbitmq://...')
assert client.hello('mark') == 'hello mark'
assert client.div(5, 2) == 2.5
with pytest.raises(ZeroDivisionError):
client.div(5, 0)
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
mause_rpc-0.0.8.tar.gz
(3.7 kB
view details)
Built Distribution
File details
Details for the file mause_rpc-0.0.8.tar.gz
.
File metadata
- Download URL: mause_rpc-0.0.8.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 852c47cc41434bb4bc7bd381138aaa07e04997a3d5704729c0a14227decb1693 |
|
MD5 | bd538ff5bd17b5c35e82b5089e2257be |
|
BLAKE2b-256 | 5bb4c3590bb0254cb61633ce4f629dc5949d37e9025774de5126d25d34c19ecd |
File details
Details for the file mause_rpc-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: mause_rpc-0.0.8-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42604bcb1ec1e199d658443a04415bc53dd2e70f8fdfed6ab1a4511bf1e33264 |
|
MD5 | 196cdee81ad1530c27edd3c3d4bcbf09 |
|
BLAKE2b-256 | 0940e605e36ae5c639a95f4fcea2d6fafa91d1b16b5955baa773481ed149ae19 |