Scalable distributed microservice framework using AMQP/RabbitMQ
Project description
From con- (“with; together”) + fluō (“flow”). cōnfluō (present infinitive cōnfluere, perfect active cōnfluxī); third conjugation, no passive 1. (intransitive) I flow or run together, meet. 2. (intransitive, figuratively) I flock or crowd together, throng, assemble.
⇢ confluo is a scalable distributed microservice framework using AMQP/RabbitMQ as a broker.
import asyncio
from confluo.core import Service
a = Service("Service-A")
b = Service("Service-B")
@b.subscribe("/foo/bar")
async def foo_bar_event(path, headers, body):
print("Got /foo/bar event with body: '{0}'".format(body))
response = await b.call("Service-A", "/bar", {"data": "Some body data"})
print("Got response: '{0}'".format(response))
@a.route("/bar")
async def bar_command(path, headers, body):
print("Got /bar command with body: '{0}'".format(body))
return {"value": 1}
if __name__ == "__main__":
# connect services
loop.run_until_complete(asyncio.wait([a.connect(), b.connect()]))
# Publish event
loop.run_until_complete(a.publish("/foo/bar", "wtf"))
loop = asyncio.get_event_loop()
try:
loop.run_forever()
except KeyboardInterrupt:
loop.run_until_complete(asyncio.wait([a.shutdown(), b.shutdown()]))
loop.stop()
loop.close()
Usage
Make sure rabbitmq is installed and running. e.g:
sudo docker run -d --hostname my-rabbit --name some-rabbit rabbitmq:3-management
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
confluo-0.0.1.tar.gz
(6.3 kB
view details)
File details
Details for the file confluo-0.0.1.tar.gz.
File metadata
- Download URL: confluo-0.0.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77cb4cb9b29f6ff1e0d40ee55730543596cc9044b473301a3097f3c586584739
|
|
| MD5 |
9b35719a21e29dfdd496c640a78810e9
|
|
| BLAKE2b-256 |
8d7c7bfaa641a8d0dd3b61cd20dcb42237206586cfe9541d88c8974ae2325d91
|