AMQPExchange::declare

(PECL amqp >= Unknown)

AMQPExchange::declareDeclare a new exchange on the broker.

Beskrivelse

public int AMQPExchange::declare ( void )

Declare a new exchange on the broker.

Parametre

Returnerings Værdier

Returns TRUE on success or FALSE on failure.

Fejl/Undtagelser

Throws AMQPExchangeException on failure.

Throws AMQPChannelException if the channel is not open.

Throws AMQPConnectionException if the connection to the broker was lost.

Eksempler

Eksempel #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();

?>

add a note add a note

User Contributed Notes 1 note

up
0
yaoliu891121 at 163 dot com
5 years ago
use AMQPExchange::declareExchange() to avoid warning
To Top