PHP Класс AMQPChannel

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

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

Метод Описание
__construct ( AMQPConnection $amqp_connection ) Create an instance of an AMQPChannel object.
basicRecover ( boolean $requeue = true ) Redeliver unacknowledged messages.
close ( ) Closes the channel.
commitTransaction ( ) : boolean Commit a pending transaction.
confirmSelect ( ) Set the channel to use publisher acknowledgements. This can only used on a non-transactional channel.
getChannelId ( ) : integer Return internal channel ID
getConnection ( ) : AMQPConnection Get the AMQPConnection object in use
getPrefetchCount ( ) : integer Get the number of messages to prefetch from the broker.
getPrefetchSize ( ) : integer Get the window size to prefetch from the broker.
isConnected ( ) : boolean Check the channel connection.
qos ( integer $size, integer $count ) : boolean Set the Quality Of Service settings for the given channel.
rollbackTransaction ( ) : boolean Rollback a transaction.
setConfirmCallback ( callable $ack_callback = null, callable $nack_callback = null ) Set callback to process basic.ack and basic.nac AMQP server methods (applicable when channel in confirm mode).
setPrefetchCount ( integer $count ) : boolean Set the number of messages to prefetch from the broker.
setPrefetchSize ( integer $size ) : boolean Set the window size to prefetch from the broker.
setReturnCallback ( callable $return_callback = null ) Set callback to process basic.return AMQP server method
startTransaction ( ) : boolean Start a transaction.
waitForBasicReturn ( float $timeout ) Start wait loop for basic.return AMQP server methods
waitForConfirm ( float $timeout ) Wait until all messages published since the last call have been either ack'd or nack'd by the broker.

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

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

Create an instance of an AMQPChannel object.
public __construct ( AMQPConnection $amqp_connection )
$amqp_connection AMQPConnection An instance of AMQPConnection with an active connection to a broker.

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

Redeliver unacknowledged messages.
public basicRecover ( boolean $requeue = true )
$requeue boolean

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

Closes the channel.
public close ( )

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

Commit a pending transaction.
public commitTransaction ( ) : boolean
Результат boolean TRUE on success or FALSE on failure.

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

Set the channel to use publisher acknowledgements. This can only used on a non-transactional channel.
public confirmSelect ( )

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

Return internal channel ID
public getChannelId ( ) : integer
Результат integer

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

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

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

Get the number of messages to prefetch from the broker.
public getPrefetchCount ( ) : integer
Результат integer

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

Get the window size to prefetch from the broker.
public getPrefetchSize ( ) : integer
Результат integer

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

Check the channel connection.
public isConnected ( ) : boolean
Результат boolean Indicates whether the channel is connected.

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

Specify the amount of data to prefetch in terms of window size (octets) or number of messages from a queue during a AMQPQueue::consume() or AMQPQueue::get() method call. The client will prefetch data up to size octets or count messages from the server, whichever limit is hit first. Setting either value to 0 will instruct the client to ignore that particular setting. A call to AMQPChannel::qos() will overwrite any values set by calling AMQPChannel::setPrefetchSize() and AMQPChannel::setPrefetchCount(). If the call to either AMQPQueue::consume() or AMQPQueue::get() is done with the AMQP_AUTOACK flag set, the client will not do any prefetching of data, regardless of the QOS settings.
public qos ( integer $size, integer $count ) : boolean
$size integer The window size, in octets, to prefetch.
$count integer The number of messages to prefetch.
Результат boolean TRUE on success or FALSE on failure.

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

Rollback an existing transaction. AMQPChannel::startTransaction() must be called prior to this.
public rollbackTransaction ( ) : boolean
Результат boolean TRUE on success or FALSE on failure.

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

Set callback to process basic.ack and basic.nac AMQP server methods (applicable when channel in confirm mode).
public setConfirmCallback ( callable $ack_callback = null, callable $nack_callback = null )
$ack_callback callable
$nack_callback callable Callback functions with all arguments have the following signature: function ack_callback(int $delivery_tag, bool $multiple) : bool; function nack_callback(int $delivery_tag, bool $multiple, bool $requeue) : bool; and should return boolean false when wait loop should be canceled. Note, basic.nack server method will only be delivered if an internal error occurs in the Erlang process responsible for a queue (see https://www.rabbitmq.com/confirms.html for details).

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

Set the number of messages to prefetch from the broker during a call to AMQPQueue::consume() or AMQPQueue::get(). Any call to this method will automatically set the prefetch window size to 0, meaning that the prefetch window size setting will be ignored.
public setPrefetchCount ( integer $count ) : boolean
$count integer The number of messages to prefetch.
Результат boolean TRUE on success or FALSE on failure.

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

Set the prefetch window size, in octets, during a call to AMQPQueue::consume() or AMQPQueue::get(). Any call to this method will automatically set the prefetch message count to 0, meaning that the prefetch message count setting will be ignored. If the call to either AMQPQueue::consume() or AMQPQueue::get() is done with the AMQP_AUTOACK flag set, this setting will be ignored.
public setPrefetchSize ( integer $size ) : boolean
$size integer The window size, in octets, to prefetch.
Результат boolean TRUE on success or FALSE on failure.

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

Set callback to process basic.return AMQP server method
public setReturnCallback ( callable $return_callback = null )
$return_callback callable Callback function with all arguments has the following signature: function callback(int $reply_code, string $reply_text, string $exchange, string $routing_key, AMQPBasicProperties $properties, string $body) : bool; and should return boolean false when wait loop should be canceled.

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

This method must be called on the given channel prior to calling AMQPChannel::commitTransaction() or AMQPChannel::rollbackTransaction().
public startTransaction ( ) : boolean
Результат boolean TRUE on success or FALSE on failure.

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

Start wait loop for basic.return AMQP server methods
public waitForBasicReturn ( float $timeout )
$timeout float Timeout in seconds. May be fractional.

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

Note, this method also catch all basic.return message from server.
public waitForConfirm ( float $timeout )
$timeout float Timeout in seconds. May be fractional.