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.11.tar.gz
(17.8 kB
view details)
Built Distribution
File details
Details for the file taskiq_sqs-0.0.11.tar.gz
.
File metadata
- Download URL: taskiq_sqs-0.0.11.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 687d35e3724634b628309ea5fc103ce0729146f5fece373a78eb4ac037cfd58e |
|
MD5 | 0d29794fe615c2b955300a39238b0e95 |
|
BLAKE2b-256 | 3f09de185221b8dc6198896d9791e5b0a3b5301acdea9eb7dd995086642324f2 |
File details
Details for the file taskiq_sqs-0.0.11-py3-none-any.whl
.
File metadata
- Download URL: taskiq_sqs-0.0.11-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c81eeec76c12e686a5f28061ded18bbc53f52942c44f9a950b2e7f1d968b5767 |
|
MD5 | c452acaf53dba4faa2825f65f26786e3 |
|
BLAKE2b-256 | 1e2a50bc4dd4b7f638c56fc001c54524378bba38d61c9ab6e69c1079f6a54ab5 |