silverbullet/plug-api/syscalls/mq.ts

23 lines
658 B
TypeScript
Raw Normal View History

import { syscall } from "../syscall.ts";
2024-02-29 22:23:05 +08:00
import type { MQStats } from "../types.ts";
2023-08-11 00:32:41 +08:00
2024-07-30 23:24:17 +08:00
export function send(queue: string, body: any): Promise<void> {
2023-08-11 00:32:41 +08:00
return syscall("mq.send", queue, body);
}
2024-07-30 23:24:17 +08:00
export function batchSend(queue: string, bodies: any[]): Promise<void> {
2023-08-11 00:32:41 +08:00
return syscall("mq.batchSend", queue, bodies);
}
2024-07-30 23:24:17 +08:00
export function ack(queue: string, id: string): Promise<void> {
2023-08-11 00:32:41 +08:00
return syscall("mq.ack", queue, id);
}
2024-07-30 23:24:17 +08:00
export function batchAck(queue: string, ids: string[]): Promise<void> {
2023-08-11 00:32:41 +08:00
return syscall("mq.batchAck", queue, ids);
}
2023-08-12 02:37:13 +08:00
2023-08-28 23:12:15 +08:00
export function getQueueStats(queue: string): Promise<MQStats> {
2023-08-12 02:37:13 +08:00
return syscall("mq.getQueueStats", queue);
}