silverbullet/plug-api/syscalls/mq.ts

23 lines
599 B
TypeScript
Raw Normal View History

import { syscall } from "$sb/syscall.ts";
2024-02-29 22:23:05 +08:00
import type { MQStats } from "../types.ts";
2023-08-11 00:32:41 +08:00
export function send(queue: string, body: any) {
return syscall("mq.send", queue, body);
}
export function batchSend(queue: string, bodies: any[]) {
return syscall("mq.batchSend", queue, bodies);
}
export function ack(queue: string, id: string) {
return syscall("mq.ack", queue, id);
}
export function batchAck(queue: string, ids: string[]) {
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);
}