DSTM - a simple message broker interface + task queue
Project description
dstm
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dca56de12e6d42441b728dd71d06312b30493144cf0293dc9ed6d9e7db36012
|
|
| MD5 |
05d7491016118c264b281462ad8c6d8b
|
|
| BLAKE2b-256 |
cec021ccf44ad09e42fb78633ffab20e78058acc94e63a7c37f4f926dc52486f
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed6af729da8d03a01308f0195c8a100f847870d25179fe4ffd7ef43c22d670d9
|
|
| MD5 |
510682953dec7d755d7cbe4f9a2b4c83
|
|
| BLAKE2b-256 |
3599c212a51c5683991fe71fd0cf36b5b351d538bb3566cc604ef5b1010ed1f4
|