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
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
py-s2s-21.6.15.tar.gz
(8.2 kB
view hashes)