to send custom headers, you need send it as associative array under attribute 'headers'
AMQPExchange::publish
(PECL amqp >= Unknown)
AMQPExchange::publish — Publie un message à échanger
Description
public bool AMQPExchange::publish
( string
$message
, string $routing_key
[, int $flags = AMQP_NOPARAM
[, array $attributes = array()
]] )Publie un message à échanger représenté par l'objet AMQPExchange.
Liste de paramètres
-
message -
Le message à publier.
-
routing_key -
La clé utilisée pour la publication.
-
flags -
Un ou plusieurs constantes
AMQP_MANDATORYetAMQP_IMMEDIATE. -
attributes -
Indexes supportés Clé Description Valeur par défaut 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
Valeurs de retour
Cette fonction retourne TRUE en cas de
succès ou FALSE si une erreur survient.
Erreurs / Exceptions
Émets une exception AMQPExchangeException si une erreur survient.
Émets une exception AMQPChannelException si le canal n'est pas ouvert.
Émets une exception AMQPConnectionException si la connexion au broker a été perdue.
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
