to send custom headers, you need send it as associative array under attribute 'headers'
AMQPExchange::publish
(PECL amqp >= Unknown)
AMQPExchange::publish — Publica un mensaje a un intercambio
Descripción
public bool AMQPExchange::publish
( string
$message
, string $routing_key
[, int $flags = AMQP_NOPARAM
[, array $attributes = array()
]] )Publica un mensaje a el intercambio representado por el objeto de AMQPExchange.
Parámetros
-
message -
El mensaje a publicar.
-
routing_key -
La clave de enrutamiento la cual se publica.
-
flags -
Uno o más
AMQP_MANDATORYyAMQP_IMMEDIATE. -
atributos -
Indices soportados Clave Descripción Valor por omisión content_type text/plain content_encoding NULL message_id NULL user_id NULL app_id NULL delivery_mode NULL priority NULL timestamp NULL expiration NULL type NULL reply_to NULL
Valores devueltos
Devuelve TRUE en caso de éxito o FALSE en caso de error.
Errores/Excepciones
Lanza una AMQPExchangeException en caso de error.
Lanza una AMQPChannelException si el canal no está abierto.
Lanza una AMQPConnectionException si se perdío la conexión al corredor.
Andy (Larest) ¶
5 months ago
glenjamin at gmail dot com ¶
1 year ago
Any unused attributes will be assigned as custom headers attached to the outgoing message's headers collection.
This isn't exactly clear from the documentation above, but I've checked the C source, and that's how you set custom headers.
prudkiy at mail dot ru ¶
1 year ago
Please note, here no way to be sure if message really published
The use of flags AMQP_MANDATORY and AMQP_IMMEDIATE not force to return any errors (in case if queue not exists etc) and "publish" returns TRUE anyway
