Skip to main content

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) -> float:
    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://...')


def test_basic_functionality():
    assert client.hello('mark') == 'hello mark'
    assert client.div(5, 2) == 2.5

    with pytest.raises(ZeroDivisionError):
        client.div(5, 0)

Project details


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.12.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

mause_rpc-0.0.12-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page