AMQPQueue
class AMQPQueue (View source)
stub class representing AMQPQueue from pecl-amqp
Methods
Acknowledge the receipt of a message.
Bind the given queue to a routing key on an exchange.
Cancel a queue that is already bound to an exchange and routing key.
Consume messages from a queue.
Declare a new queue on the broker.
Declare a new queue on the broker.
Delete a queue from the broker.
Retrieve the next message from the queue.
Get all the flags currently set on the given queue.
Get the configured name.
Mark a message as explicitly not acknowledged.
Mark one message as explicitly not acknowledged.
Recover unacknowledged messages delivered to the current consumer.
Purge the contents of a queue.
Get the argument associated with the given key.
Set a queue argument.
Set a queue argument.
Set all arguments on the given queue.
Get all set arguments as an array of key/value pairs.
Check whether a queue has specific argument.
Set the flags on the queue.
Set the queue name.
Remove a routing key binding on an exchange from the given queue.
Get the AMQPChannel object in use
Get the AMQPConnection object in use
Get latest consumer tag. If no consumer available or the latest on was canceled null will be returned.
Details
__construct(AMQPChannel $channel)
Create an instance of an AMQPQueue object.
void
ack(int $deliveryTag, int|null $flags = null)
Acknowledge the receipt of a message.
This method allows the acknowledgement of a message that is retrieved without the AMQP_AUTOACK flag through AMQPQueue::get() or AMQPQueue::consume()
void
bind(string $exchangeName, string|null $routingKey = null, array $arguments = [])
Bind the given queue to a routing key on an exchange.
void
cancel(string $consumer_tag = '')
Cancel a queue that is already bound to an exchange and routing key.
void
consume(callable $callback = null, int|null $flags = null, string|null $consumerTag = null)
Consume messages from a queue.
Blocking function that will retrieve the next message from the queue as it becomes available and will pass it off to the callback.
int
declareQueue()
Declare a new queue on the broker.
int
declare()
Declare a new queue on the broker.
int
delete(int|null $flags = null)
Delete a queue from the broker.
This includes its entire contents of unread or unacknowledged messages.
AMQPEnvelope|null
get(int|null $flags = null)
Retrieve the next message from the queue.
Retrieve the next available message from the queue. If no messages are present in the queue, this function will return NULL immediately. This is a non blocking alternative to the AMQPQueue::consume() method. Currently, the only supported flag for the flags parameter is AMQP_AUTOACK. If this flag is passed in, then the message returned will automatically be marked as acknowledged by the broker as soon as the frames are sent to the client.
int
getFlags()
Get all the flags currently set on the given queue.
string|null
getName()
Get the configured name.
void
nack(int $deliveryTag, int|null $flags = null)
Mark a message as explicitly not acknowledged.
Mark the message identified by delivery_tag as explicitly not acknowledged. This method can only be called on messages that have not yet been acknowledged, meaning that messages retrieved with by AMQPQueue::consume() and AMQPQueue::get() and using the AMQP_AUTOACK flag are not eligible. When called, the broker will immediately put the message back onto the queue, instead of waiting until the connection is closed. This method is only supported by the RabbitMQ broker. The behavior of calling this method while connected to any other broker is undefined.
void
reject(int $deliveryTag, int|null $flags = null)
Mark one message as explicitly not acknowledged.
Mark the message identified by delivery_tag as explicitly not acknowledged. This method can only be called on messages that have not yet been acknowledged, meaning that messages retrieved with by AMQPQueue::consume() and AMQPQueue::get() and using the AMQP_AUTOACK flag are not eligible.
void
recover(bool $requeue = true)
Recover unacknowledged messages delivered to the current consumer.
Recover all the unacknowledged messages delivered to the current consumer.
If $requeue is true, the broker can redeliver the messages to different
consumers. If $requeue is FALSE, it can only redeliver it to the current
consumer. RabbitMQ does not implement $request = false.
This method exposes basic.recover
from the AMQP spec.
int
purge()
Purge the contents of a queue.
Returns the number of purged messages
bool|int|float|string|null|array|AMQPValue|AMQPDecimal|AMQPTimestamp
getArgument(string $argumentName)
Get the argument associated with the given key.
void
setArgument(string $argumentName, bool|int|float|string|null|array|AMQPValue|AMQPDecimal|AMQPTimestamp $argumentValue)
Set a queue argument.
void
removeArgument(string $argumentName)
Set a queue argument.
void
setArguments(array $arguments)
Set all arguments on the given queue.
All other argument settings will be wiped.
array
getArguments()
Get all set arguments as an array of key/value pairs.
bool
hasArgument(string $argumentName)
Check whether a queue has specific argument.
void
setFlags(int|null $flags = null)
Set the flags on the queue.
void
setName(string $name)
Set the queue name.
void
unbind(string $exchangeName, string|null $routingKey = null, array $arguments = [])
Remove a routing key binding on an exchange from the given queue.
AMQPChannel
getChannel()
Get the AMQPChannel object in use
AMQPConnection
getConnection()
Get the AMQPConnection object in use
string|null
getConsumerTag()
Get latest consumer tag. If no consumer available or the latest on was canceled null will be returned.