downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

AMQPExchange::setArgument> <AMQPExchange::getType
[edit] Last updated: Fri, 24 May 2013

view this page in

AMQPExchange::publish

(PECL amqp >= Unknown)

AMQPExchange::publishメッセージを exchange に発行する

説明

public bool AMQPExchange::publish ( string $message , string $routing_key [, int $flags = AMQP_NOPARAM [, array $attributes = array() ]] )

AMQPExchange オブジェクトがあらわす exchange にメッセージを発行します。

パラメータ

message

公開するメッセージ。

routing_key

公開先へのルーティングキー。

flags

AMQP_MANDATORY および AMQP_IMMEDIATE のひとつ以上。

attributes

サポートするインデックス
キー 説明 デフォルト値
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

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

エラー / 例外

失敗した場合に AMQPExchangeException をスローします。

チャネルが開いていない場合に AMQPChannelException をスローします。

ブローカへの接続が途切れた場合に AMQPConnectionException をスローします。



AMQPExchange::setArgument> <AMQPExchange::getType
[edit] Last updated: Fri, 24 May 2013
 
add a note add a note User Contributed Notes AMQPExchange::publish - [4 notes]
up
0
Andy (Larest)
5 months ago
to send custom headers, you need send it as associative array under attribute 'headers'
up
0
zircote
1 year ago
additional attribute to the publish method is

`correlation_id`
up
0
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.
up
0
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

 
show source | credits | sitemap | contact | advertising | mirror sites