*/ interface QueueInterface extends \Countable, LoggerAwareInterface, PhpSerializable, ServiceLocatorAwareInterface { /** * @deprecated It will be removed in version 1.0.0. Use QueueDispatcherInterface::SERVICE_ID instead */ const SERVICE_ID = 'taoTaskQueue/taskQueue'; /** * @deprecated It will be removed in version 1.0.0 */ const OPTION_QUEUE_BROKER = 'queue_broker'; /** * QueueInterface constructor. * * @param string $name * @param QueueBrokerInterface $broker * @param int $weight */ public function __construct($name, QueueBrokerInterface $broker, $weight = 1); /** * @return string */ public function __toString(); /** * Initialize queue. * * @return void */ public function initialize(); /** * Returns queue name. * * @return string */ public function getName(); /** * Returns queue weight. * * @return int */ public function getWeight(); /** * @param int $weight * @return QueueInterface */ public function setWeight($weight); /** * Publish a task to the queue. * * @param TaskInterface $task * @param null|string $label Label for the task * @return bool Is the task successfully enqueued? */ public function enqueue(TaskInterface $task, $label = null); /** * Receive a task from the queue. * * @return null|TaskInterface */ public function dequeue(); /** * Acknowledge that the task has been received and consumed. * * @param TaskInterface $task */ public function acknowledge(TaskInterface $task); /** * Is the given queue a sync queue? * * @return bool */ public function isSync(); /** * The amount of tasks that can be received in one pop by this queue. * * @return int */ public function getNumberOfTasksToReceive(); /** * Set new broker. * * @param QueueBrokerInterface $broker * @return QueueInterface */ public function setBroker(QueueBrokerInterface $broker); /** * @return QueueBrokerInterface */ public function getBroker(); }