AMQPExchange
在线手册:中文  英文

AMQPExchange::declare

(PECL amqp >= Unknown)

AMQPExchange::declareDeclare a new exchange on the broker.

说明

public int AMQPExchange::declare ( void )

Declare a new exchange on the broker.

参数

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

错误/异常

Throws AMQPExchangeException on failure.

Throws AMQPChannelException if the channel is not open.

Throws AMQPConnectionException if the connection to the broker was lost.

范例

Example #1 AMQPExchange::declare() example

<?php

/* Create a new connection */
$cnn = new AMQPConnection();
$cnn->connect();

$ch = new AMQPChannel($cnn);

$ex = new AMQPExchange($ch);
$ex->setName('new_topic_exchange');
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->setFlags(AMQP_DURABLE AMQP_AUTODELETE);
$ex->declare();

?>


AMQPExchange
在线手册:中文  英文

用户评论:

danil dot mipt at gmail dot com (2013-06-04 12:21:13)

deprecated.
Use AMQPExchange::declareExchange() and AMQPQueue::declareQueue() as the main methods.
https://github.com/pdezwart/php-amqp/pull/58

易百教程