PHP Класс AMQPExchange

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( AMQPChannel $amqp_channel ) Create an instance of AMQPExchange.
bind ( string $exchange_name, string $routing_key = '', array $arguments = [] ) : boolean Bind to another exchange.
declareExchange ( ) : boolean Declare a new exchange on the broker.
delete ( string $exchangeName = null, integer $flags = AMQP_NOPARAM ) : boolean Delete the exchange from the broker.
getArgument ( string $key ) : string | integer | boolean Get the argument associated with the given key.
getArguments ( ) : array Get all arguments set on the given exchange.
getChannel ( ) : AMQPChannel Get the AMQPChannel object in use
getConnection ( ) : AMQPConnection Get the AMQPConnection object in use
getFlags ( ) : integer Get all the flags currently set on the given exchange.
getName ( ) : string Get the configured name.
getType ( ) : string Get the configured type.
hasArgument ( string $key ) : boolean Check whether argument associated with the given key exists.
publish ( string $message, string $routing_key = null, integer $flags = AMQP_NOPARAM, array $attributes = [] ) : boolean Publish a message to an exchange.
setArgument ( string $key, string | integer $value ) : boolean Set the value for the given key.
setArguments ( array $arguments ) : boolean Set all arguments on the exchange.
setFlags ( integer $flags ) : void Set the flags on an exchange.
setName ( string $exchange_name ) : void Set the name of the exchange.
setType ( string $exchange_type ) : void Set the type of the exchange.
unbind ( string $exchange_name, string $routing_key = '', array $arguments = [] ) : boolean Remove binding to another exchange.

Описание методов

__construct() публичный Метод

Returns a new instance of an AMQPExchange object, associated with the given AMQPChannel object.
public __construct ( AMQPChannel $amqp_channel )
$amqp_channel AMQPChannel A valid AMQPChannel object, connected to a broker.

bind() публичный Метод

Bind an exchange to another exchange using the specified routing key.
public bind ( string $exchange_name, string $routing_key = '', array $arguments = [] ) : boolean
$exchange_name string Name of the exchange to bind.
$routing_key string The routing key to use for binding.
$arguments array Additional binding arguments.
Результат boolean true on success or false on failure.

declareExchange() публичный Метод

Declare a new exchange on the broker.
public declareExchange ( ) : boolean
Результат boolean TRUE on success or FALSE on failure.

delete() публичный Метод

Delete the exchange from the broker.
public delete ( string $exchangeName = null, integer $flags = AMQP_NOPARAM ) : boolean
$exchangeName string Optional name of exchange to delete.
$flags integer Optionally AMQP_IFUNUSED can be specified to indicate the exchange should not be deleted until no clients are connected to it.
Результат boolean true on success or false on failure.

getArgument() публичный Метод

Get the argument associated with the given key.
public getArgument ( string $key ) : string | integer | boolean
$key string The key to look up.
Результат string | integer | boolean The string or integer value associated with the given key, or FALSE if the key is not set.

getArguments() публичный Метод

Get all arguments set on the given exchange.
public getArguments ( ) : array
Результат array An array containing all of the set key/value pairs.

getChannel() публичный Метод

Get the AMQPChannel object in use
public getChannel ( ) : AMQPChannel
Результат AMQPChannel

getConnection() публичный Метод

Get the AMQPConnection object in use
public getConnection ( ) : AMQPConnection
Результат AMQPConnection

getFlags() публичный Метод

Get all the flags currently set on the given exchange.
public getFlags ( ) : integer
Результат integer An integer bitmask of all the flags currently set on this exchange object.

getName() публичный Метод

Get the configured name.
public getName ( ) : string
Результат string The configured name as a string.

getType() публичный Метод

Get the configured type.
public getType ( ) : string
Результат string The configured type as a string.

hasArgument() публичный Метод

Check whether argument associated with the given key exists.
public hasArgument ( string $key ) : boolean
$key string The key to look up.
Результат boolean

publish() публичный Метод

Publish a message to the exchange represented by the AMQPExchange object.
public publish ( string $message, string $routing_key = null, integer $flags = AMQP_NOPARAM, array $attributes = [] ) : boolean
$message string The message to publish.
$routing_key string The optional routing key to which to publish to.
$flags integer One or more of AMQP_MANDATORY and AMQP_IMMEDIATE.
$attributes array One of content_type, content_encoding, message_id, user_id, app_id, delivery_mode, priority, timestamp, expiration, type or reply_to, headers.
Результат boolean TRUE on success or FALSE on failure.

setArgument() публичный Метод

Set the value for the given key.
public setArgument ( string $key, string | integer $value ) : boolean
$key string Name of the argument to set.
$value string | integer Value of the argument to set.
Результат boolean TRUE on success or FALSE on failure.

setArguments() публичный Метод

Set all arguments on the exchange.
public setArguments ( array $arguments ) : boolean
$arguments array An array of key/value pairs of arguments.
Результат boolean TRUE on success or FALSE on failure.

setFlags() публичный Метод

Set the flags on an exchange.
public setFlags ( integer $flags ) : void
$flags integer A bitmask of flags. This call currently only considers the following flags: AMQP_DURABLE, AMQP_PASSIVE (and AMQP_DURABLE, if librabbitmq version >= 0.5.3)
Результат void

setName() публичный Метод

Set the name of the exchange.
public setName ( string $exchange_name ) : void
$exchange_name string The name of the exchange to set as string.
Результат void

setType() публичный Метод

Set the type of the exchange. This can be any of AMQP_EX_TYPE_DIRECT, AMQP_EX_TYPE_FANOUT, AMQP_EX_TYPE_HEADERS or AMQP_EX_TYPE_TOPIC.
public setType ( string $exchange_type ) : void
$exchange_type string The type of exchange as a string.
Результат void

unbind() публичный Метод

Remove a routing key binding on an another exchange from the given exchange.
public unbind ( string $exchange_name, string $routing_key = '', array $arguments = [] ) : boolean
$exchange_name string Name of the exchange to bind.
$routing_key string The routing key to use for binding.
$arguments array Additional binding arguments.
Результат boolean true on success or false on failure.