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.6.tar.gz
(16.5 kB
view hashes)
Built Distribution
taskiq_sqs-0.0.6-py3-none-any.whl
(12.5 kB
view hashes)
Close
Hashes for taskiq_sqs-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb55aa8a6d601faf7bff64ac1666e0e4a3996faafa5773b5cd7c42bc81a4b123 |
|
MD5 | 63f00676e8fd0c42ba73da5b363cd925 |
|
BLAKE2b-256 | 9cd020f49fe19b30cd83b2bb5150a8be570131c3ecc2fed93adfbb3f6b17eb9f |