Microservice gateway using Nats
Project description
Metropolis (Python Microservice Gateway with NATS)
Can we make
simple
,scalable
,observable
,operable
service gateway?
Architecture Concept
+- Node-1 --+ +- Node-2 -+ +- Node-3 --+ +- Node-4 -+
| | | | | | | |
| Worker-a | | | | | | Worker-d |
| Worker-b | | Worker-c | | Worker-a | | Worker-c |
| | | | | | | | | | | |
| NATS ========= NATS ======================= NATS |
| | | | | | | | | |
| Gateway | | | | Gateway | | |
| | | | | | | | | |
+--- | -----+ +----------+ +--- | -----+ +----------+
| |
+--------------+-------------+
|
Ingress
Components
Nats
Message bus
Worker
Business Logic worker
Gateway
Service gateway
Example
Install metropolis
$ pip install metropolis
Define Worker task
from metropolis import Worker
worker = Worker(nats='nats://localhost:4222')
@worker.task(subject='foo.bar', queue='worker')
def mytask(data, *args, **kwargs):
"""Simple task which returns reverse string
"""
return data[0][::-1]
worker.run()
Define Gateway
from metropolis import Gateway
import settings
gateway = Gateway(nats='nats://nats:4222')
gateway.app.run(host='0.0.0.0')
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
metropolis-0.1.4.dev0.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for metropolis-0.1.4.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04fe1371ebd99c9d564270155e7d2e62ef537852e7fd581c955965616ae8e1ad |
|
MD5 | c17f86074bcdcf8fdfd1e7477aefef1a |
|
BLAKE2b-256 | 82cee6f831cb6f3a348f28b67880682db1e43deeda38c88e047bbae57cfe4e02 |