I am trying to send a request to AMQP, stuck at how to add header to the request message, the below is the wrapper we are having
$message = ‘{"empId": ‘.$empId.', “empName”:”my name"}’;
$resData = $rpcClient->call($message, self::EXCHANGE, self::ROUTING_KEY);
How to add headers to the above message
the call method is the wrapper we have written
public function call($requestMessage, $exchange, $routingKey)
{
$this->response = null;
$this->correlationId = uniqid('abcprod', true);
$message = new AMQPMessage(
strval($requestMessage),
array('correlation_id' => $this->correlationId, 'reply_to' => $this->callbackQueue)
);
$this->channel
->basic_publish($message, $exchange, $routingKey);
try {
$this->channel->wait(null, false, self::REQUEST_TIMEOUT);
} catch (AMQPTimeoutException $e) {
return null;
}
return $this->response;
}