Files
plainleaf/website/API/mq.md
T
Zef HemelandGitHub dc2987a3f9 Sync engine rearchitecture (#1516)
* Don't require auth for .ping
* Finally introducing loggers
* Remove file list caching from disk_space_primitives
I don't think this is required anymore with the sync model
* Simplification of space primitives and more tests
* More reliable online status
* Add .zed settings
* Remove selfUpdate argument from `writeFile` no longer used
- Add `sync` config schema and document sync options
- Move sync config handling to client boot logic
- Move BootConfig type to ui_types.ts
- Remove sync env vars from server
- Update documentation for sync and architecture
* Improve sync logic and proxy routing for full sync state
* Add BoxProxy for late-bound client and improve Lua boot
- Add isMobile syscall for editor
* Add concurrency to sync process and log indexing duration
* Better service worker lifecycle management
2025-09-12 14:43:57 +02:00

62 lines
1.2 KiB
Markdown

# Message Queue API
The Message Queue API provides functions for implementing a simple message queue system.
## Message Operations
### mq.send(queue, body)
Sends a message to a queue.
Example:
```lua
mq.send("tasks", {type = "process", data = "sample"})
```
### mq.batchSend(queue, bodies)
Sends multiple messages to a queue in a single operation.
Example:
```lua
local messages = {
{type = "task1", data = "sample1"},
{type = "task2", data = "sample2"}
}
mq.batchSend("tasks", messages)
```
### mq.ack(queue, id)
Acknowledges a message from a queue, marking it as processed.
Example:
```lua
mq.ack("tasks", "message-123")
```
### mq.batchAck(queue, ids)
Acknowledges multiple messages from a queue in a single operation.
Example:
```lua
local messageIds = {"msg1", "msg2", "msg3"}
mq.batchAck("tasks", messageIds)
```
## Queue Management
### mq.getQueueStats(queue)
Retrieves statistics about a particular queue.
Example:
```lua
local stats = mq.getQueueStats("tasks")
print("Queue size: " .. stats.size)
print("Processing: " .. stats.processing)
```
### mq.awaitEmptyQueue(queue)
Waits for a queue to become empty.
Example:
```lua
mq.awaitEmptyQueue("tasks")
```