Skip to main content

DSTM - a simple message broker interface + task queue

Project description

dstm

PyPI

A simple task queue library compatible with AWS SQS or AMQP.

I'm writing dstm because I've been experiencing problems with celery. Celery is big and complicated, and has many great features that I don't need; which makes tracking down problems difficult. I just need something that does the absolute basics reliably. That's what dstm is designed to be.

Quick Start

Define a task in any python module, e.g. in myapp.tasks.email:

from dstm import task

@task(queue="high-priority")
def send_email(recipient: str, content: str):
    ...

Submit an instance of the task to a message broker:

from dstm import TaskBroker
from dstm.client.sqs import SQSClient

from myapp.tasks.email import send_email

broker = TaskBroker(
    SQSClient(boto3.client("sqs")),
    queue_prefix="myapp-",
)
broker.submit(send_email, "linus@example.com", "Hi tehre")

Run a worker that executes tasks from the broker:

from dstm import TaskBroker
from dstm.client.sqs import SQSClient

broker = TaskBroker(
    SQSClient(boto3.client("sqs")),
    queue_prefix="myapp-",
)

broker.run_worker(queues=["high-priority"])

Or using the CLI:

python3 -m dstm worker \
    --broker-uri "sqs://" \
    --queue-prefix "myapp-" \
    --queues "high-priority"

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

dstm-0.1.6.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

dstm-0.1.6-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file dstm-0.1.6.tar.gz.

File metadata

  • Download URL: dstm-0.1.6.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for dstm-0.1.6.tar.gz
Algorithm Hash digest
SHA256 7dca56de12e6d42441b728dd71d06312b30493144cf0293dc9ed6d9e7db36012
MD5 05d7491016118c264b281462ad8c6d8b
BLAKE2b-256 cec021ccf44ad09e42fb78633ffab20e78058acc94e63a7c37f4f926dc52486f

See more details on using hashes here.

File details

Details for the file dstm-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: dstm-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for dstm-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ed6af729da8d03a01308f0195c8a100f847870d25179fe4ffd7ef43c22d670d9
MD5 510682953dec7d755d7cbe4f9a2b4c83
BLAKE2b-256 3599c212a51c5683991fe71fd0cf36b5b351d538bb3566cc604ef5b1010ed1f4

See more details on using hashes here.

Supported by

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