Skip to main content

SQS client

Project description

Digital Fortress logo


Python SQS client

Getting Started

Install package

pip install sqs-client

Example

Subscribe

from sqs_client.client import SQSClient

sqs_client = SQSClient()


# Subscribe to a SQS
@sqs_client.task(
    queue_name="sqs-queue-name",
    wait_time_seconds=0,
    visibility_timeout=300,
    daemon=False,
)
def test_task(message):
    print("test_task received:", message)

Publish

from sqs_client.client import SQSClient
from sqs_client.publisher import Publisher

sqs_client = SQSClient()

sqs_client.publish(
    queue_name="sqs-queue-name",
    message="test message",
)

# or

publisher = Publisher(
    sqs_client=sqs_client,
    queue_name="sqs-queue-name",
)

publisher.publish("test message")

Lazy mode

Faster to subscribe and publish a message to SQS

from sqs_client.client import SQSClient

sqs_client = SQSClient()


# Subscribe to a SQS
@sqs_client.task(
    queue_name="sqs-queue-name",
    lazy=True,
    daemon=False,
    wait_time_seconds=0,
    visibility_timeout=300,
)
def test_task(message, abc):
    print("test_task received message:", message)
    print("test_task received abc:", abc)


# Publish a message
test_task.trigger("Test message", abc=1)

Publish a lazy mode message without subscribe

from sqs_client.client import SQSClient
from sqs_client.publisher import Publisher

sqs_client = SQSClient()

publisher = Publisher(
    sqs_client=sqs_client,
    queue_name="sqs-queue-name",
)

publisher.publish_lazy("Test lazy message", abc=1)

License

This project is Copyright (c) 2023 and onwards Digital Fortress. It is free software and may be redistributed under the terms specified in the LICENSE file.

About

Digital Fortress logo

This project is made and maintained by Digital Fortress.

We are an experienced team in R&D, software, hardware, cross-platform mobile and DevOps.

See more of our projects or do you need to complete one?

-> Let’s connect with us

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

sqs-client-0.1.2.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

sqs_client-0.1.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file sqs-client-0.1.2.tar.gz.

File metadata

  • Download URL: sqs-client-0.1.2.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for sqs-client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1f7bb3445ec1914ff10f1518559a9e2d2342880e6c27c92a3890bcb2a859d956
MD5 eb33d1ca32043e363196e2c8c25c6418
BLAKE2b-256 9b4f2f4421cf9247ed5f4cb2a0a397b49e5e228edf614dadebd8d0384ad1677e

See more details on using hashes here.

Provenance

File details

Details for the file sqs_client-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: sqs_client-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for sqs_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eaba1802ac8a255974a820054c1aa9fac645f2c9428a52a4648998370b669776
MD5 37440278ad6f01c80cff55034ab3db7b
BLAKE2b-256 fafe7339cc437f502fcbf1b166364799d9e0e34efeee7b587493aaf70d57b934

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