Python asynch distributed and scalable Queue Services
Project description
PyAsynch
PyAsynch is a package to create distributed Python Services through RabbitMQ.
The services talk each other through a common RabbitMQ queue and expose the service also as HTTP Tornado Server
How to use it
pip install pyasynch
or
pip3 install pyasynch
or just clone the git repo.
Create your custom node
from pyasynch.node import Node
class MyNode(Node):
def mymethod(self,arg1,arg2,**kwargs):
return {'myproperty':'myvalue'}
def mysecondmethod(self,myproperty,**kwargs):
return {}
Create the configuration file (e.g. myconfig.json)
{
"endpoint": {
"amqp": "amqp://guest:guest@127.0.0.1:5672/pyasynch",
"id": "myendpoint",
"threaded": false
}
}
Create the routing file (e.g. myroutes.json)
{
"routes": {
"pyasynch://myendpoint/mynode/mymethod" : ["pyasynch://myendpoint/mynode/mysecondmethod"],
}
Create the main (e.g. main.py) runner and register the node
# IMPORTS
from pyasynch.environment import Environment
env = Environment()
env.register_node('mynode',MyNode(env.endpoint))
try:
env.run()
except KeyboardInterrupt:
env.stop()
Everything is ready, now you can run the endpoint service (check if RabbitMQ is running properly)
python3 main.py -c myconfig.json -r myroutes.json -p 8081
You can replicate nodes and endpoint logic in a scalable way.
You can then perform JSON get or POST to the endpoint: http://127.0.0.1:8081/mynode/mymethod
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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file PyAsynch-1.2.2-py3-none-any.whl.
File metadata
- Download URL: PyAsynch-1.2.2-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1584ae5568172b67dd400e48d55967bd94b9736ea5ffaf3d658748ee439dfbb5
|
|
| MD5 |
6d0e7817a17fdd8f68cc35f8fb45653a
|
|
| BLAKE2b-256 |
45183948bea58c1c5936da5d77e24c820c629b7531ff7d2f7321046248a58454
|