0210
Some checks failed
test / Run tests (push) Failing after 13s
build / Build (push) Failing after 22s
Some checks failed
test / Run tests (push) Failing after 13s
build / Build (push) Failing after 22s
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user