Metadata-Version: 2.2
Name: aiotaskqueue
Version: 0.7.0
Summary: Asynchronous task queue framework
Author-email: Doctor <thirvondukr@gmail.com>
License: MIT
Project-URL: Repository, https://github.com/ThirVondukr/aiotaskqueue
Project-URL: Issues, https://github.com/ThirVondukr/aiotaskqueue/issues
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: anyio>=4.6.2.post1
Requires-Dist: msgspec>=0.18.6
Requires-Dist: typing-extensions>=4.8.0
Provides-Extra: redis
Requires-Dist: redis>=5.2.0; extra == "redis"
Provides-Extra: scheduler
Requires-Dist: croniter>=5.0.1; extra == "scheduler"

Asyncqueue is a type-safe and fast distributed queue alternative to celery, rq and arq.

## Example Usage

```python
import asyncio

from redis.asyncio import Redis

from aiotaskqueue import Configuration, Publisher, TaskRouter, TaskParams
from aiotaskqueue.broker.redis import RedisBroker, RedisBrokerConfig
from aiotaskqueue.serialization.msgspec import MsgSpecSerializer
from aiotaskqueue.serialization.pydantic import PydanticSerializer

router = TaskRouter()


@router.task(TaskParams(name="task-name"))
async def task(a: int, b: str) -> None:
    print(a, b)


async def main() -> None:
    configuration = Configuration(
        serialization_backends=[PydanticSerializer()],
        default_serialization_backend=MsgSpecSerializer(),
    )

    redis = Redis(host="127.0.0.1")
    broker = RedisBroker(
        redis=redis,
        consumer_name="asyncqueue",
        broker_config=RedisBrokerConfig(xread_count=100),
    )
    publisher = Publisher(broker=broker, config=configuration)
    async with redis, broker:
        await publisher.enqueue(task(a=42, b="string"))


if __name__ == "__main__":
    asyncio.run(main())

```
