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

Uploaded Source

Built Distribution

taskiq_sqs-0.0.4-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: taskiq_sqs-0.0.4.tar.gz
  • Upload date:
  • Size: 16.3 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.4.tar.gz
Algorithm Hash digest
SHA256 7856d0d412eb705c4bc7f8c2ce708cd543d7ce54d2a9bb0608f1f4582fc49b90
MD5 8b413a12f9c4e480f6f706e8d247531c
BLAKE2b-256 7e3cf49cdd63633d4657653ccc7136b892b957b2cbe4e77b1f207bcced9b2efb

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: taskiq_sqs-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 12.3 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fe169700bcc7c16ac7e3a471a29436a2e928a13068ec341b16766a3437200992
MD5 43682256ca058642bd789e09fc3f766a
BLAKE2b-256 b791651096f913c7a2b2997ca3c9d9bc226e4ec3a6868d947a8a7bae42240f4e

See more details on using hashes here.

Provenance

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