Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 63 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,63 @@
## TaskIQ-Redis
# 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:
```bash
pip install taskiq
```
This project can be installed using pip:
```bash
pip install taskiq-redis
```

# Usage

Let's see the example with the redis broker and redis async result:
```python
import asyncio

from taskiq_redis.redis_broker import RedisBroker
from taskiq_redis.redis_backend import RedisAsyncResultBackend


redis_async_result = RedisAsyncResultBackend(
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 my_async_task.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:
* `url` - url to redis.
14 changes: 13 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@ name = "taskiq-redis"
version = "0.0.2"
description = "Redis integration for taskiq"
authors = ["taskiq-team <taskiq@norely.com>"]

readme = "README.md"
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
homepage = "https://github.com/taskiq-python/taskiq-redis"
repository = "https://github.com/taskiq-python/taskiq-redis"
keywords = ["taskiq", "tasks", "distributed", "async", "redis", "result_backend"]

[tool.poetry.dependencies]
python = "^3.7"
Expand Down