SQS Broker for TaskIQ
Project description
TaskIQ SQS Broker
Mostly generic SQS async broker for TaskIQ.
Expiration
If you set the sqs_expiry
label to a unix timestamp, the message will be discarded if the worker receives it after that time.
import asyncio
from taskiq_sqs import SQSBroker
broker = SQSBroker("http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/my-queue")
@broker.task
async def add_one(value: int) -> int:
return value + 1
async def main() -> None:
# Never forget to call startup in the beginning.
await broker.startup()
# Send the task to the broker.
task = await add_one.kiq(1)
# Wait for the result. (result backend must be configured)
result = await task.wait_result(timeout=2)
print(f"Task execution took: {result.execution_time} seconds.")
if not result.is_err:
print(f"Returned value: {result.return_value}")
else:
print("Error found while executing task.")
await broker.shutdown()
if __name__ == "__main__":
asyncio.run(main())
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_sqs-0.0.10.tar.gz
(17.5 kB
view details)
Built Distribution
File details
Details for the file taskiq_sqs-0.0.10.tar.gz
.
File metadata
- Download URL: taskiq_sqs-0.0.10.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0521fb2e83c0f63bb297a716bb44470792ce5905ddab456aedc433798ebd5693 |
|
MD5 | 6793dfdfa6caa29d6469aca1beaf4005 |
|
BLAKE2b-256 | 36c46c6509dfd4c733a54232ad5b09eb4dab382296a0560a7bfee28f18e4b9ed |
File details
Details for the file taskiq_sqs-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: taskiq_sqs-0.0.10-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4669aceca60eb432f1ae86766cb27c53868b6b786c99221f9df6696f8375d283 |
|
MD5 | 08ba05f49c2d488548fdae62224b80bb |
|
BLAKE2b-256 | 3c9d31ef50cce87127931767347e748fae60637a3530c54ee618b4ab097e53da |