diff --git a/src/AmqpQueue.php b/src/AmqpQueue.php index 49087be..82c5fc0 100644 --- a/src/AmqpQueue.php +++ b/src/AmqpQueue.php @@ -9,6 +9,11 @@ */ class AmqpQueue extends Queue { + /** + * @var int + */ + protected $size = 0; + /** * {@inheritdoc} * @@ -19,6 +24,16 @@ public function __construct(AmqpContext $amqpContext, $queueName, $timeToRun) parent::__construct($amqpContext, $queueName, $timeToRun); } + /** + * {@inheritdoc} + */ + public function size($queue = null) + { + $this->declareQueue($queue); + + return $this->size; + } + /** * {@inheritdoc} */ @@ -57,6 +72,6 @@ protected function declareQueue($queue = null) $interopQueue = $this->getQueue($queue); $interopQueue->addFlag(\Interop\Amqp\AmqpQueue::FLAG_DURABLE); - $this->getQueueInteropContext()->declareQueue($interopQueue); + $this->size = $this->getQueueInteropContext()->declareQueue($interopQueue); } }