Skip to main content

CurateClick

github.com favicon

基于Redis Stream的Python异步队列库

一个基于Redis Stream构建的Python异步队列库,支持Asyncio、推迟任务、死信队列和多消费者功能。

Check out 基于Redis Stream的Python异步队列库 on CurateClick

• Copy the embed code to showcase this product on your website

• Share on X to spread the word about this amazing tool

基于最新的Redis版本构建的异步队列库,受启发于arq仓库: https://github.com/Wh1isper/brqLICENSE:[BSD-3-Clause license](https://github.com/Wh1isper/brq#BSD-3-Clause-1-ov-file)特性:- 异步Asyncio支持- 推迟任务、死信队列- 多消费者支持#### 生产者代码案例pythonimport osfrom brq.producer import Producerfrom brq.tools import get_redis_client, get_redis_urlasync def main(): redis_url = get_redis_url( host=os.getenv("REDIS_HOST", "localhost"), port=int(os.getenv("REDIS_PORT", 6379)), db=int(os.getenv("REDIS_DB", 0)), cluster=bool(os.getenv("REDIS_CLUSTER", False)), tls=bool(os.getenv("REDIS_TLS", False)), ) async with get_redis_client(redis_url) as async_redis_client: await Producer(async_redis_client).run_job("echo", ["hello"])if __name__ == "__main__": import asyncio asyncio.run(main())#### 消费者代码案例pythonimport osfrom brq.consumer import Consumerfrom brq.daemon import Daemonfrom brq.tools import get_redis_client, get_redis_urlasync def echo(message): print(message)async def main(): redis_url = get_redis_url( host=os.getenv("REDIS_HOST", "localhost"), port=int(os.getenv("REDIS_PORT", 6379)), db=int(os.getenv("REDIS_DB", 0)), cluster=bool(os.getenv("REDIS_CLUSTER", False)), tls=bool(os.getenv("REDIS_TLS", False)), ) async with get_redis_client(redis_url) as async_redis_client: daemon = Daemon(Consumer(async_redis_client, echo)) await daemon.run_forever()if __name__ == "__main__": import asyncio asyncio.run(main())

Latest Weekly Picks

promptbuilder.cc favicon
Weekly Pick

Generate, optimize, test, and manage AI prompts in one place. Turn an idea into a ready-to-use prompt in seconds.

Prompt Builder
freqz.net favicon
Weekly Pick

Your Personal K-Style Vibe Photo Studio

Freqz
webleadr.com favicon
Weekly Pick

Find and contact web design leads and businesses without websites, like local dentists, effortlessly from any location in just a few clicks.

Webleadr

the art of having something to say

pretty-scale.com favicon
Weekly Pick

How Pretty Are You? Let AI Decide.

Pretty Scale
c2story.com favicon
Weekly Pick

Create Illustrated Stories with AI

C2story

Impromptu Speech Topics & Timer

Seedance 2.0: Multimodal AI video creator. Precisely direct characters and cameras to create production-ready, multi-shot cinematic stories in one click.