使用php-enqueue和RabbitMQ发送消息时添加头

fhg3lkii  于 2022-11-08  发布在  RabbitMQ
关注(0)|答案(1)|浏览(137)

我正在尝试使用php-enqueue包发送一个标头我正在尝试这个:

public function __construct(
    ProducerInterface    $producer
)
{
    parent::__construct();

    $this->producer = $producer;
}

//... Inside function...
$m = new Message(
   'message to send',
    [],
    [
       'm' => 1
    ]
);

$this->producer->sendCommand('newMessageFromApi', $m);

但是头并没有到达消费者。这些是唯一到达的头。

[
      "content_type" => "text/plain",
      "delivery_mode" => 2,
      "message_id" => "38f96af0-64de-4a31-9315-6b51dd5f8baf",
      "timestamp" => 1652027271
]
wbgh16ku

wbgh16ku1#

试试这个

$m = new Message('message to send',['m' => 1]);

相关问题