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.7.tar.gz
(16.6 kB
view details)
Built Distribution
File details
Details for the file taskiq_sqs-0.0.7.tar.gz
.
File metadata
- Download URL: taskiq_sqs-0.0.7.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e593c11ca3ce1979e395cb271940fbb206f742e61913824b5dd31d2619d673cf |
|
MD5 | f11fc7dbd311d3bf9771f8527d28c9fc |
|
BLAKE2b-256 | 2c5c7e14124b0ebe1a6aec7f9a8709c24504e8d752eb312178e8fc94d35528b9 |
File details
Details for the file taskiq_sqs-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: taskiq_sqs-0.0.7-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9852f0dd552748115d9ced01fd5dfa85b85956fe94cf8aac561ee8d05fa8340 |
|
MD5 | efd3237e13ee9583003a7e703a2d3473 |
|
BLAKE2b-256 | 42fa371a0e4c112aba05594147ccff5a32329246da6c94157c815f307fefd2ec |