Redis integration for taskiq
Project description
TaskIQ-Redis
Taskiq-redis is a plugin for taskiq that adds a new broker and result backend based on redis.
Installation
To use this project you must have installed core taskiq library:
pip install taskiq
This project can be installed using pip:
pip install taskiq-redis
Usage
Let's see the example with the redis broker and redis async result:
import asyncio
from taskiq_redis.redis_broker import RedisBroker
from taskiq_redis.redis_backend import RedisAsyncResultBackend
redis_async_result = RedisAsyncResultBackend(
redis_url="redis://localhost:6379",
)
broker = RedisBroker(
url="redis://localhost:6379",
result_backend=redis_async_result,
)
@broker.task
async def best_task_ever() -> None:
"""Solve all problems in the world."""
await asyncio.sleep(5.5)
print("All problems are solved!")
async def main():
task = await best_task_ever.kiq()
print(await task.get_result())
asyncio.run(main())
RedisBroker configuration
RedisBroker parameters:
url
- url to redis.task_id_generator
- custom task_id genertaor.result_backend
- custom result backend.queue_name
- name of the pub/sub channel in redis.max_connection_pool_size
- maximum number of connections in pool.
RedisAsyncResultBackend configuration
RedisAsyncResultBackend parameters:
redis_url
- url to redis.keep_results
- flag to not remove results from Redis after reading.
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 Distribution
taskiq_redis-0.1.0.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for taskiq_redis-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9caafdead4433c7404ea6d781578f67056376d653a02abdc134a91a7993fbf20 |
|
MD5 | 23bbcfba0cdaf0c5b1ac8d77a3709ca5 |
|
BLAKE2b-256 | 7adccab38fc190bfd4211b6c320b1ec3cd5da5e18e11d892107275316b2cb952 |