Skip to main content

onestep-sqs

Amazon SQS connector plugin for onestep. The package also ships an Amazon SNS topic sink for fan-out publishing.

pip install onestep-sqs

The package registers these YAML resource types through the onestep.resources entry point:

  • sqs
  • sqs_queue
  • sns
  • sns_topic

Python usage:

from onestep_sqs import SQSConnector, SNSConnector

Delivery metadata

Fetched messages keep the existing OneStep body decoding behavior and expose SQS system metadata under delivery.envelope.meta["sqs"]:

{
    "message_id": "00000000-0000-0000-0000-000000000000",
    "attributes": {
        "ApproximateReceiveCount": "2",
        "SentTimestamp": "1720000000000",
    },
}

The current message's MessageId sets message_id. Its Attributes sets attributes to an isolated snapshot of the complete system attributes dictionary. When no existing SQS metadata or current system fields are available, meta["sqs"] is an empty dictionary.

Existing envelope meta and attempts values are preserved. If the encoded envelope already contains a meta["sqs"] dictionary, its other keys are kept. The reserved message_id and attributes keys are populated only from the current SQS response, so missing fields do not inherit stale transport values.

ReceiptHandle remains internal to acknowledgement, retry, and release operations. Custom SQS MessageAttributes are not exposed in the envelope.

Shutdown and pause behavior

SQS receives use a blocking long poll, so shutdown, drain, and pause wait for the current poll to finish instead of cancelling it. Any deliveries returned after fetching has stopped are released immediately with a visibility timeout of zero when processing has not started, making them available to SQS consumers again without waiting for the configured visibility timeout.

SNS topic sink

SNS is publish/subscribe only, so SNSTopic implements Sink (not Source). To consume SNS messages, subscribe an SQS queue to the topic and use sqs_queue as the source.

from onestep import MemoryQueue, OneStepApp
from onestep_sqs import SNSConnector

app = OneStepApp("sns-demo")
sns = SNSConnector(region_name="us-east-1")
notify = sns.topic(
    "arn:aws:sns:us-east-1:123456789012:events",
    subject="onestep-event",
)


@app.task(source=MemoryQueue("jobs"), emit=notify)
async def publish_event(ctx, job):
    return {"id": job["id"], "status": "done"}

The task return value is encoded with the standard OneStep envelope codec and sent as the SNS Message. Configuration options:

  • subject: optional SNS Subject.
  • message_attributes: raw SNS MessageAttributes mapping for subscription filter policies.
  • message_group_id / deduplication_id_factory: required (group) and optional (dedup) for FIFO topics whose ARN ends in .fifo. The factory receives the Envelope and returns the deduplication id string.
  • retry_delay_s: retry backoff hint applied to normalized connector errors.

YAML:

resources:
  sns:
    type: sns
    region_name: us-east-1
  notify:
    type: sns_topic
    connector: sns
    arn: arn:aws:sns:us-east-1:123456789012:events
    subject: onestep-event

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onestep_sqs-0.2.4.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onestep_sqs-0.2.4-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file onestep_sqs-0.2.4.tar.gz.

File metadata

  • Download URL: onestep_sqs-0.2.4.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for onestep_sqs-0.2.4.tar.gz
Algorithm Hash digest
SHA256 fdb30955c3a8a1eb1a982e00cd530fcc0c8087aef5391facc3cc38f17230406e
MD5 122e90346862bcc46b4f0ada2de2eac0
BLAKE2b-256 5b6395723a6ca3a81d7f5608d552775caad5fd33d538184d40646d5fbd739e58

See more details on using hashes here.

File details

Details for the file onestep_sqs-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: onestep_sqs-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for onestep_sqs-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 70c58e84589e2184fda397e1d11ac6717be8fc11d00d16ef58c269663fa8c49d
MD5 6ca86faba0fa6cd9c6948f33bc75cdba
BLAKE2b-256 02618fa43e2d1fb33ad3295fdd588678cbc2d128c4c2c16b639a23bdf9b457bb

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page