<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] ### egg-amqplib 基于 rabbitmq 消息隊列封裝的庫 文檔:[https://github.com/zubincheung/egg-amqplib](https://github.com/zubincheung/egg-amqplib) 示例代碼:[https://github.com/zubincheung/egg-amqplib/blob/master/test/fixtures/apps/amqplib-test/app/controller/home.js](https://github.com/zubincheung/egg-amqplib/blob/master/test/fixtures/apps/amqplib-test/app/controller/home.js) ``` 'use strict'; const Controller = require('egg').Controller; const queueName = 'test'; class HomeController extends Controller { async publish() { const { msg } = this.ctx.query; const ch = await this.app.amqplib.createChannel(); await ch.assertQueue(queueName, { durable: false }); const ok = await ch.sendToQueue(queueName, Buffer.from(msg)); await ch.close(); this.ctx.body = ok; this.ctx.status = 200; } 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))); if (msg !== null) { ch.ack(msg); await ch.close(); this.ctx.status = 200; this.ctx.body = { msg: msg.content.toString() }; } else { this.ctx.status = 500; } } } module.exports = HomeController; ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看