0210
Some checks failed
test / Run tests (push) Failing after 13s
build / Build (push) Failing after 22s

This commit is contained in:
2025-02-10 18:10:50 +08:00
parent 1e8b5e6453
commit 36cf8ef5a7
11 changed files with 71 additions and 35 deletions

View File

@@ -11,8 +11,10 @@ export class Broker {
// 订阅
async subscribe(topic: string, handler: SubscribeCallback): Promise<MessageConnect> {
LoggerCore.getInstance().logger({ service: "messageQueue" }).debug("subscribe", { topic });
const con = await this.msg.connect({ action: "messageQueue", data: { action: "subscribe", topic } });
con.onMessage((msg: { action: string; topic: string; message: any }) => {
console.log(msg);
if (msg.action === "message") {
handler(msg.message);
}