Metropolis (Python Microservice Gateway with NATS)
Can we make
simple,scalable,observable,operableservice gateway?
Purpose
Cloud Native
Single Workload Unit
Service Discovery
Service Mesh
Architecture Concept
+- Cluster --------------------------------------------------+
| |
| +- 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 |
+--------------------- | ------------------------------------+
V
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')
Metadata
Release files for metropolis 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| metropolis-0.1.4.tar.gz | 6.2 kB | Without provenance | Details for metropolis-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| metropolis-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for metropolis-0.1.4-py3-none-any.whl |
Total release size: 15.1 kB
Release files / metropolis-0.1.4.tar.gz
| Download URL | metropolis-0.1.4.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7c872719a0349d3ccfe5446b9a3c17092dcfd0f07e25eb490fa4526e9b5d9e7
|
|
BLAKE2b-256 checksum How to use checksums |
8af0db138aa910d7f865dbecf20b52276a9814fd97a479d21d58c5f55f36bea9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / metropolis-0.1.4-py3-none-any.whl
| Download URL | metropolis-0.1.4-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05636c54e07648e0172dc6d84858195e116f4ee5f6f5fded6bb087f00ffe912b
|
|
BLAKE2b-256 checksum How to use checksums |
1e2a2f27cca00f8b70208f6f44bb48cfd4553600f1ece6562ac3e6891ca4a374
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for metropolis 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.