Skip to main content

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


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.3.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

taskiq_sqs-0.0.3-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file taskiq_sqs-0.0.3.tar.gz.

File metadata

  • Download URL: taskiq_sqs-0.0.3.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for taskiq_sqs-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c74f86a1f3895730e829f93bd14b01781d9a233101987ca37b8e87d758136332
MD5 01406f7ed090486d6654b2d1501164f9
BLAKE2b-256 213ac5b985e3ffa300f8b18c595444a315f995113aa95556d4c42d750b5dccea

See more details on using hashes here.

File details

Details for the file taskiq_sqs-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: taskiq_sqs-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for taskiq_sqs-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6d06cade24aefcf17a629f3e6a5bd4377a2357158a20dc0524d6bb8e35941af7
MD5 03413413b78dfbaecbf445cbe14a8907
BLAKE2b-256 56b099f0317e72d39677a3cbecb7216d554cfecb20c1d88227195bd2c0d15342

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page