______ __ __ ______ __
/ \| \ / \/ \| \
| ▓▓▓▓▓▓\ ▓▓\ / ▓▓ ▓▓▓▓▓▓\ ▓▓
| ▓▓___\▓▓ ▓▓▓\ / ▓▓▓ ▓▓ | ▓▓ ▓▓
\▓▓ \| ▓▓▓▓\ ▓▓▓▓ ▓▓ | ▓▓ ▓▓
_\▓▓▓▓▓▓\ ▓▓\▓▓ ▓▓ ▓▓ ▓▓ _| ▓▓ ▓▓
| \__| ▓▓ ▓▓ \▓▓▓| ▓▓ ▓▓/ \ ▓▓ ▓▓_____
\▓▓ ▓▓ ▓▓ \▓ | ▓▓\▓▓ ▓▓ ▓▓ ▓▓ \
\▓▓▓▓▓▓ \▓▓ \▓▓ \▓▓▓▓▓▓\\▓▓▓▓▓▓▓▓
\▓▓▓
smol in-memory mq in rust.
supports add, get/consume, delete/ack, retry, purge, and peek operations. includes example producer and consumer web UIs.
messages in SMQL move through the following distinct states:
- ready: available for consumers to retrieve
- processing: locked by consumer, invisible to others (peek as workaround for visibility, only for demoing)
{
"id": "uuid",
"body": "string",
"state": "Ready" | "Processing",
"lock_until": null,
"retry_count": 0
}
- consumer retrieves message via /get
- message locks automatically (processing state)
- consumer processes the message
- on success: delete message via /delete
- on failure: return to queue via /retry
- no persistence - all messages lost on server restart
- no TTL - Messages remain until explicitly deleted
- no dead letter queue - retry count increments but messages retry indefinitely
POST /add
{"body": "text"}returns:
{
"id": "uuid",
"body": "text",
"state": "ready",
"retry_count": 0
}POST /get
{"count": 5}returns messages and marks them as:
processing- invisible until deleted or retried
[
{
"id": "uuid",
"body": "text",
"state": "processing",
"retry_count": 0
}
]POST /delete
{"ids": ["uuid1", "uuid2"]}permanently removes messages.
POST /retry
{"ids": ["uuid1", "uuid2"]}moves messages back to ready and increments retry_count.
POST /purge
{}clears all messages.
POST /peek
{"count": 5}returns messages without changing state or visibility.
[
{
"id": "uuid",
"body": "text",
"state": "ready",
"retry_count": 0
}
]# add message
curl -X POST localhost:1337/add \
-H "Content-Type: application/json" \
-d '{"body":"Process this task"}'
# get and process
curl -X POST localhost:1337/get \
-H "Content-Type: application/json" \
-d '{"count":1}'
# peek the queue
curl -X POST localhost:1337/peek \
-H "Content-Type: application/json" \
-d '{"count":1}'
# success - delete message
curl -X POST localhost:1337/delete \
-H "Content-Type: application/json" \
-d '{"ids":["returned-uuid-here"]}'
# failure - retry message
curl -X POST localhost:1337/retry \
-H "Content-Type: application/json" \
-d '{"ids":["returned-uuid-here"]}'to start smql
cargo runto view the webserver demo,
cd ./static
npx serveproducer and consumer files at ./producer.html and ./consumer.html