Metadata-Version: 2.3
Name: fastapi_queue_task
Version: 0.0.11
Summary: FastAPI Queue
Project-URL: Homepage, https://github.com/megatron-global/fastapi-queue
Project-URL: Bug Tracker, https://github.com/megatron-global/fastapi-queue/issues
Author-email: Dzung Nguyen <dung@megatron-solutions.com>
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: fastapi>=0.103.1
Requires-Dist: pydash>=0.5.0
Description-Content-Type: text/markdown

# FastAPI queue

## How to use

1. Instance the class `Queue` with `redis` instance and `options`

```python
# queue_config.py

from fastapi_queue_task import Queue
from redis.asyncio.utils import from_url

redis = from_url(
    f"redis://#REDIS_HOST:#REDIS_PORT/#REDIS_DATABASE_NAME",
    encoding="utf-8",
    decode_responses=True,
)
queue = Queue(redis, options={'concurrency': 10, 'max_attempt': 3})
queue.run()
```

2. Add task to queue:

```python
# mail_service.py
await queue.add_to_queue(name="TASK_NAME", data: Any = {})
```

## How to test in testpypi

1. Increase the version in `pyproject.toml`
2. Run command

```bash
$ . ./build_and_test.sh
```

## How to publish new version

1. Increase the version in `pyproject.toml`
2. Run command

```bash
$ . ./build_and_publish.sh
```
