Fixes #115: By introducing MQ workers

This commit is contained in:
Zef Hemel
2023-08-10 18:32:41 +02:00
parent c6fce524e6
commit 97a84e8538
16 changed files with 544 additions and 7 deletions
+6
View File
@@ -0,0 +1,6 @@
export type Message = {
id: string;
queue: string;
body: any;
retries?: number;
};
+1
View File
@@ -3,4 +3,5 @@ export * as events from "./event.ts";
export * as shell from "./shell.ts";
export * as store from "./store.ts";
export * as YAML from "./yaml.ts";
export * as mq from "./mq.ts";
export * from "./syscall.ts";
+17
View File
@@ -0,0 +1,17 @@
import { syscall } from "$sb/plugos-syscall/syscall.ts";
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);
}