<bdo id='yX0d1'></bdo><ul id='yX0d1'></ul>
<legend id='yX0d1'><style id='yX0d1'><dir id='yX0d1'><q id='yX0d1'></q></dir></style></legend>
<tfoot id='yX0d1'></tfoot>
    1. <i id='yX0d1'><tr id='yX0d1'><dt id='yX0d1'><q id='yX0d1'><span id='yX0d1'><b id='yX0d1'><form id='yX0d1'><ins id='yX0d1'></ins><ul id='yX0d1'></ul><sub id='yX0d1'></sub></form><legend id='yX0d1'></legend><bdo id='yX0d1'><pre id='yX0d1'><center id='yX0d1'></center></pre></bdo></b><th id='yX0d1'></th></span></q></dt></tr></i><div id='yX0d1'><tfoot id='yX0d1'></tfoot><dl id='yX0d1'><fieldset id='yX0d1'></fieldset></dl></div>

        <small id='yX0d1'></small><noframes id='yX0d1'>

      1. RabbitMQ 是否会在有消息时为消费者调用回调函数?

        Does RabbitMQ call the callback function for a consumer when it has some message for it?(RabbitMQ 是否会在有消息时为消费者调用回调函数?)

          <small id='ruVcc'></small><noframes id='ruVcc'>

            <tbody id='ruVcc'></tbody>

            <i id='ruVcc'><tr id='ruVcc'><dt id='ruVcc'><q id='ruVcc'><span id='ruVcc'><b id='ruVcc'><form id='ruVcc'><ins id='ruVcc'></ins><ul id='ruVcc'></ul><sub id='ruVcc'></sub></form><legend id='ruVcc'></legend><bdo id='ruVcc'><pre id='ruVcc'><center id='ruVcc'></center></pre></bdo></b><th id='ruVcc'></th></span></q></dt></tr></i><div id='ruVcc'><tfoot id='ruVcc'></tfoot><dl id='ruVcc'><fieldset id='ruVcc'></fieldset></dl></div>
            <legend id='ruVcc'><style id='ruVcc'><dir id='ruVcc'><q id='ruVcc'></q></dir></style></legend>
              • <bdo id='ruVcc'></bdo><ul id='ruVcc'></ul>

                <tfoot id='ruVcc'></tfoot>
                • 本文介绍了RabbitMQ 是否会在有消息时为消费者调用回调函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  RabbitMQ 是否在有消息时为消费者调用回调函数,或者消费者是否必须轮询 RabbitMQ 客户端?

                  所以在消费者端,如果有 PHP 脚本,RabbitMQ 可以调用它并将消息/参数传递给它.例如如果在 shard 1 上提交了 rating 并且 aggregateRating 表在 shard 2 上,那么 shard 2 上的 RabbitMQ 消费者会触发脚本 aggRating.php 并传递插入到 shard 1 中的参数吗?

                  解决方案

                  你想要的是 basic.consume,它允许代理向客户端推送消息.

                  也就是说,这些库的实现方式不同.它们中的大多数都支持 basic.consume,但由于所使用框架的固有限制,有些不支持(最值得注意的是许多其他客户端所基于的官方 RabbitMQ C 客户端).

                  如果您的 PHP 库不支持 basic.consume,您要么必须使用轮询(不好),要么可以使用更完整的客户端之一来驱动脚本.例如,您可以编写一个从代理消费的 Python 或 Java 程序(因此,代理 推送 向它们传递)并且他们可以在收到新消息时调用脚本.官方教程很好地介绍了 AMQP API,是一个很好的起点.p>

                  从大多数角度来看,这很有效,但它确实需要与代理的稳定连接.

                  如果对各种客户端的功能有疑问,或者如果您需要更多指导,RabbitMQ 讨论 邮件列表是提问的好地方.开发人员会重点回答那里发布的任何问题.

                  Does RabbitMQ call the callback function for a consumer when it has some message for it, or does the consumer have to poll the RabbitMQ client?

                  So on the consumer side, if there is a PHP script, can RabbitMQ call it and pass the message/parameters to it. e.g. if rating is submitted on shard 1 and the aggregateRating table is on shard 2, then would RabbitMQ consumer on shard 2 trigger the script say aggRating.php and pass the parameters that were inserted in shard 1?

                  解决方案

                  What you want is basic.consume, which allows the broker to push messages to clients.

                  That said, the libraries are implemented differently. Most of them have support for basic.consume, but because of inherent limitations of the frameworks used, some don't (most notably the official RabbitMQ C client on which a lot of other clients are based).

                  If your PHP library does not support basic.consume, you either have to use polling (bad), or you could use one of the more complete clients to drive the script. For instance, you could write a Python or Java program that consumes from the broker (so, the broker pushes deliveries to them) and they could call the script whenever a new message is received. The official tutorials are a great introduction to the AMQP APIs and are a good place to start.

                  This is efficient from most points of view, but it does require a stable connection to the broker.

                  If in doubt about the capabilities of the various clients, or if you need more guidance, the RabbitMQ Discuss mailing list is a great place to ask questions. The developers make a point of answering any query posted there.

                  这篇关于RabbitMQ 是否会在有消息时为消费者调用回调函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <bdo id='iBQZW'></bdo><ul id='iBQZW'></ul>

                    1. <small id='iBQZW'></small><noframes id='iBQZW'>

                    2. <i id='iBQZW'><tr id='iBQZW'><dt id='iBQZW'><q id='iBQZW'><span id='iBQZW'><b id='iBQZW'><form id='iBQZW'><ins id='iBQZW'></ins><ul id='iBQZW'></ul><sub id='iBQZW'></sub></form><legend id='iBQZW'></legend><bdo id='iBQZW'><pre id='iBQZW'><center id='iBQZW'></center></pre></bdo></b><th id='iBQZW'></th></span></q></dt></tr></i><div id='iBQZW'><tfoot id='iBQZW'></tfoot><dl id='iBQZW'><fieldset id='iBQZW'></fieldset></dl></div>
                      <tfoot id='iBQZW'></tfoot>
                        <tbody id='iBQZW'></tbody>

                      1. <legend id='iBQZW'><style id='iBQZW'><dir id='iBQZW'><q id='iBQZW'></q></dir></style></legend>