💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] ### 消息应答 ack >[danger] noAck: false 手动接收消息模式 ``` async consume() { const ch = await this.app.amqplib.createChannel(); await ch.assertQueue(queueName, { durable: false }); const msg = await new Promise(resolve => ch.consume(queueName, msg => resolve(msg) , { noAck: false } )); if (msg !== null) { // 告诉MQ 我已经收到消息并处理完成了,MQ会删除队列中的消息,并从内存中删除 ch.ack(msg); await ch.close(); this.ctx.status = 200; this.ctx.body = { msg: msg.content.toString() }; } else { this.ctx.status = 500; } } ``` ***** ### 消息持久化