中文版 | English
wukongqueue
一个纯Python3实现的轻量且易于使用的跨网络队列服务
wukongqueue的本地队列服务的实现基于Python标准库
queue.
特点
- 快(基于tcp长连接通信)
- 支持多线程调用(连接池)
- 支持所有Python原生类型
- 支持断开自动重连
- 上手成本低,api使用和标准库
queue保持一致 - 可设置认证秘钥
环境要求
- Python3.5+ (need type hints)
安装
pip install wukongqueue
例子
server.py
from wukongqueue import WuKongQueue
import time
# start a queue server
svr = WuKongQueue(host='127.0.0.1', port=666, max_conns=10, max_size=0)
with svr:
print("svr is started!")
svr.put(b"1")
svr.put(b"2")
print("putted b'1' and b'2', wait for clients...")
time.sleep(10)
print("svr closed!")
clientA.py
from wukongqueue import WuKongQueueClient
client = WuKongQueueClient(host='127.0.0.1', port=666)
with client:
print("got", client.get()) # b"1"
client.task_done()
import time
wait = 5
time.sleep(wait)
print("after %s seconds, got" % wait,
client.get(block=True)) # wait for a while, then print b"2"
client.task_done()
print("clientA: all task done!")
clientB.py
from wukongqueue import WuKongQueueClient
client = WuKongQueueClient(host='127.0.0.1', port=666)
with client:
client.join()
print("clientB all task done!")
按上面的顺序启动三个程序,可以看到如下打印:
# server.py 首先打印
svr is started! (马上)
putted b'1' and b'2', wait for clients... (马上)
svr closed! (10秒后)
# clientA print secondly
got b'1' (马上)
after 5 seconds, got b'2' (5秒后)
clientA: all task done! (马上)
# clientB print lastly
clientB all task done! (与clientA的all task done同步)
连接池
from wukongqueue import ConnectionPool,WuKongQueueClient
pool = ConnectionPool(host="localhost", port=2020, max_connections=3)
client = WuKongQueueClient(connection_pool=pool)
TODO
- 持久化
版本发布日志
License
Metadata
Release files for wukongqueue 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wukongqueue-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for wukongqueue-0.0.6-py3-none-any.whl |
Release files / wukongqueue-0.0.6-py3-none-any.whl
| Download URL | wukongqueue-0.0.6-py3-none-any.whl |
|---|---|
| Size | 20.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
270e6450235ec987c29604756c43ff8d982332d9d850280d31839c28c796c2bb
|
|
BLAKE2b-256 checksum How to use checksums |
49faf9adada3b73ee16558c68ae9d41bebec0372d3b1b85a4e5fa0f32b6f86d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.6.0
|
Security for wukongqueue 0.0.6
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.