2014-07-24 14:30
浏览 222

RabbitMQ PHP AMQP库 - 获取消息头

I have got a simple queueing system which, obviously, takes messages and publishes them.

However, due to a new development in the system, we now need to check for the x-death headers from the exchange, however, I can't seem any documentation on how to retrieve that through the PHP AMQP Library.

Anyone have any ideas on how to achieve this?

图片转代码服务由CSDN问答提供 功能建议

我有一个简单的排队系统,显然会收集消息并发布它们。 \ n

但是,由于系统中的新开发,我们现在需要检查来自交换的 x-death 标头,但是,我似乎无法找到有关如何检索的任何文档 通过PHP AMQP库。


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duancao1951 2014-07-24 16:18

    Check for it in application_headers property.

    Here is a brief modified code from example:

     * @param \PhpAmqpLib\Message\AMQPMessage $msg
    function process_message($msg)
        $headers = $msg->get('application_headers');
        $props = ['x-death'];
        // OR
        $props = $msg->get_properties();
    $ch->basic_consume($queue, $consumer_tag, false, false, false, false, 'process_message');
    解决 无用
    打赏 举报

相关推荐 更多相似问题