dqueue-0.1.2
توضیحات
python通用延迟消息队列
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | dqueue-0.1.2 |
| نام | dqueue |
| نسخه کتابخانه | 0.1.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | miclon |
| ایمیل نویسنده | jcnd@163.com |
| آدرس صفحه اصلی | https://github.com/mic1on/delay_queue |
| آدرس اینترنتی | https://pypi.org/project/dqueue/ |
| مجوز | - |
## Usage
> pip install dqueue
## Example
### Memory Queue
```python
# memory queue
import threading
from dqueue.queues import MemoryQueue
from dqueue.item import Item
queue = MemoryQueue()
# 模拟不同延迟发布消息
def publisher():
for i in range(10):
item = Item(data=f'hello {i}')
queue.add(item, i * 1000)
# 模拟消费端取延迟消息
def consumer():
while True:
messages = queue.get(block=10 * 1000)
for msg in messages:
print('message:', msg)
threading.Thread(target=publisher).start()
threading.Thread(target=consumer).start()
```
### Redis Queue
You can continue with the example above and Just change the declare.
```python
from dqueue.queues import RedisQueue
queue = RedisQueue()
# same code
```
نیازمندی
| مقدار | نام |
|---|---|
| >=4.3.4,<5.0.0 | redis |
| >=2.10.5,<3.0.0 | AMQPStorm |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8,<4.0 | Python |
نحوه نصب
نصب پکیج whl dqueue-0.1.2:
pip install dqueue-0.1.2.whl
نصب پکیج tar.gz dqueue-0.1.2:
pip install dqueue-0.1.2.tar.gz