1
0
silverbullet/plugos/lib/mq.ts

17 lines
571 B
TypeScript
Raw Normal View History

2023-08-28 15:12:15 +00:00
import { MQMessage, MQStats, MQSubscribeOptions } from "$sb/types.ts";
export interface MessageQueue {
batchSend(queue: string, bodies: any[]): Promise<void>;
send(queue: string, body: any): Promise<void>;
subscribe(
queue: string,
options: MQSubscribeOptions,
callback: (messages: MQMessage[]) => Promise<void> | void,
): () => void;
ack(queue: string, id: string): Promise<void>;
batchAck(queue: string, ids: string[]): Promise<void>;
getQueueStats(queue: string): Promise<MQStats>;
getAllQueueStats(): Promise<Record<string, MQStats>>;
}