Skip to content
Python AMQP RPC library
Branch: master
Clone or download
Latest commit 4d030c7 Aug 17, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Add unittests for credentials. Aug 17, 2018
LICENSE Add license Jul 3, 2018


Earlgrey is a python library which provides a convenient way to publish and consume messages between processes using RabbitMQ. It is abstracted to RPC pattern.

How to use

# RPC methods
class Task:
    async def echo(self, value):
        return value

# Client stub
class Stub(MessageQueueStub[Task]):
    TaskType = Task

# Server service
class Service(MessageQueueService[Task]):
    TaskType = Task

async def run():
    route_key = 'any same string between processes'

    client = Stub('localhost', route_key)
    server = Service('localhost', route_key)

    await client.connect()
    await server.connect()

    result = await client.async_task().echo('any value')
    print(result)  # 'any value'

loop = asyncio.get_event_loop()


Actually MessageQueueStub does not need exact Task class which has full implementation of methods. It just needs signature of methods.

# client side.
class Task:
    async def echo(self, value):
        # Just signature. It is okay. Do not need implemetation.
        # But server must have its implementation
You can’t perform that action at this time.