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
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.3.tar.gz
(5.6 kB
view details)
Built Distribution
File details
Details for the file metropolis-0.1.3.tar.gz
.
File metadata
- Download URL: metropolis-0.1.3.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
203ab8a05f5f4a46315747743419192195b14c99f9de71fa5b29f190cd93699a
|
|
MD5 |
423656dd89cca64e6c6736ec0ba9ae25
|
|
BLAKE2b-256 |
73b82d52f87e4f5ced15b7437a247525893de4211e17bb0ae28675fd9926cf39
|
File details
Details for the file metropolis-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: metropolis-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
6634dac3be9493f79c5af911003153ae9fd1e659dcddc513b5efc24fd31f56e7
|
|
MD5 |
3c77ab490c4b59642acf24152ce70610
|
|
BLAKE2b-256 |
1f53a723ab3cc7836a023f8bae6827ca668589f9239d126a2db16fbeda7246c5
|