/** * Tries to locate the queue that handles the request and returns the instance * if one can be found. * * @param \AppserverIo\Psr\Pms\QueueContextInterface $queueManager The queue manager instance * @param \AppserverIo\Psr\Pms\QueueInterface $queue The queue request * * @return \AppserverIo\Psr\Pms\QueueInterface The requested queue instance * @see \AppserverIo\Appserver\MessageQueue\ResourceLocator::locate() */ public function locate(QueueContextInterface $queueManager, QueueInterface $queue) { // load registered queues and requested queue name $queues = $queueManager->getQueues(); // return the requested message queue for the passed priority key, if available if (array_key_exists($queueName = $queue->getName(), $queues)) { return $queues[$queueName]; } }
/** * Initializes and returns a new proxy instance for the passed queue. * * @param \AppserverIo\Psr\Pms\QueueInterface $queue The queue to create the proxy for * * @return \AppserverIo\Psr\Pms\QueueInterface The proxy instance */ public static function createFromQueue(QueueInterface $queue) { return new QueueProxy($queue->getName()); }
/** * Returns TRUE if the application is related with the * passed queue instance. * * @param \AppserverIo\Psr\Pms\QueueInterface $queue The queue the application has to be related to * * @return boolean TRUE if the application is related, else FALSE */ public function hasQueue(QueueInterface $queue) { return array_key_exists($queue->getName(), $this->getQueues()); }