Skip to main content

Python service to service communication over rabbitmq ephemeral queues

Project description

Py S2S

This is a simple publish and subscribe for a response over RabbitMQ. This is only half of two parts needed for "http over rabbit" intended for service to service communication.

notice

This is an asyncio library that uses aio-pika.

example

async def run():
    conn = RabbitConfig(
        host='localhost',
        port=5672,
        username='guest',
        password='guest',
        exchange='/',
        queue_name='my_queue'  # This is a prefix, it will append a random string to the end of this.
    )
    c = Service2Service(service_name='Test Service', config=conn)
    headers = {
        'authorization': 'Bearer XX',
        'content-type': 'application/json'
    }
    r = await c.request('accounts.load', dict(test=True, name='bob'), headers=headers)
    print(r)  # Returns a `S2S GenericResponse` dataclass

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

py-s2s-22.2.28.tar.gz (8.3 kB view hashes)

Uploaded Source

Built Distribution

py_s2s-22.2.28-py3-none-any.whl (8.9 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