apubsub-0.2.5
توضیحات
Message service implementing publisher/subscriber pattern
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | apubsub-0.2.5 |
| نام | apubsub |
| نسخه کتابخانه | 0.2.5 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Anton Kachurin |
| ایمیل نویسنده | katchuring@gmail.com |
| آدرس صفحه اصلی | https://github.com/outcatcher/apubsub |
| آدرس اینترنتی | https://pypi.org/project/apubsub/ |
| مجوز | MIT |
# APubSub
[](https://travis-ci.org/outcatcher/apubsub)
[](https://codecov.io/gh/outcatcher/apubsub)
[](https://pypi.org/project/apubsub/)

Simple, single-purpose message service implementation.
### Installation
_Python versin 3.7+ required_
Just install it with pip: `pip install apubsub`
### Usage
```python
from apubsub import Service
service = Service()
# Note that service is started in stand-alone process
# so start it as early as possible to minimize resource pickling*
service.start()
class Klass:
def __init__(self):
self.sub = service.get_client()
await self.sub.start_consuming() # subscriber should be started
self.pub = service.get_client() # if used only as publisher, it is not required
async def do_smth(self):
data = await self.sub.get(.1) # fetch received data with timeout
if data is None:
print("No data received by subscriber")
return
print(data)
async def do_smth_else(self):
msg = "some string data"
await self.pub.publish("topic", msg)
async def use_iter_get(self):
async for data in self.sub.get_iter():
print(f"Data received: {data}")
```
_Check out more examples in tests_
نیازمندی
| مقدار | نام |
|---|---|
| >=0.14.0,<0.15.0) | uvloop |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7,<4.0 | Python |
نحوه نصب
نصب پکیج whl apubsub-0.2.5:
pip install apubsub-0.2.5.whl
نصب پکیج tar.gz apubsub-0.2.5:
pip install apubsub-0.2.5.tar.gz