PHP Class AMQPExchange

Afficher le fichier Open project: pdezwart/php-amqp Class Usage Examples

Méthodes publiques

Méthode Description
__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.

Method Details

__construct() public méthode

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() public méthode

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.
Résultat boolean true on success or false on failure.

declareExchange() public méthode

Declare a new exchange on the broker.
public declareExchange ( ) : boolean
Résultat boolean TRUE on success or FALSE on failure.

delete() public méthode

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.
Résultat boolean true on success or false on failure.

getArgument() public méthode

Get the argument associated with the given key.
public getArgument ( string $key ) : string | integer | boolean
$key string The key to look up.
Résultat string | integer | boolean The string or integer value associated with the given key, or FALSE if the key is not set.

getArguments() public méthode

Get all arguments set on the given exchange.
public getArguments ( ) : array
Résultat array An array containing all of the set key/value pairs.

getChannel() public méthode

Get the AMQPChannel object in use
public getChannel ( ) : AMQPChannel
Résultat AMQPChannel

getConnection() public méthode

Get the AMQPConnection object in use
public getConnection ( ) : AMQPConnection
Résultat AMQPConnection

getFlags() public méthode

Get all the flags currently set on the given exchange.
public getFlags ( ) : integer
Résultat integer An integer bitmask of all the flags currently set on this exchange object.

getName() public méthode

Get the configured name.
public getName ( ) : string
Résultat string The configured name as a string.

getType() public méthode

Get the configured type.
public getType ( ) : string
Résultat string The configured type as a string.

hasArgument() public méthode

Check whether argument associated with the given key exists.
public hasArgument ( string $key ) : boolean
$key string The key to look up.
Résultat boolean

publish() public méthode

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.
Résultat boolean TRUE on success or FALSE on failure.

setArgument() public méthode

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.
Résultat boolean TRUE on success or FALSE on failure.

setArguments() public méthode

Set all arguments on the exchange.
public setArguments ( array $arguments ) : boolean
$arguments array An array of key/value pairs of arguments.
Résultat boolean TRUE on success or FALSE on failure.

setFlags() public méthode

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)
Résultat void

setName() public méthode

Set the name of the exchange.
public setName ( string $exchange_name ) : void
$exchange_name string The name of the exchange to set as string.
Résultat void

setType() public méthode

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.
Résultat void

unbind() public méthode

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.
Résultat boolean true on success or false on failure.