public function queue(StorkCommandInstance $commandInstance, $queueName, $launcherExecute = TRUE)
 {
     $instanceManagerModel = new StorkInstanceManagerModel($this->getEntityManager());
     $queueModel = new StorkQueueModel($this->getEntityManager());
     if ($instanceManagerModel->queueExists($queueName) == FALSE) {
         $queueIdNew = $instanceManagerModel->createNewQueue($queueName);
         $queueId = $instanceManagerModel->getQueueId($queueName);
         if ($queueIdNew !== $queueId) {
             throw new \Exception("Cannot create new queue");
         }
     } else {
         $queueId = $instanceManagerModel->getQueueId($queueName);
     }
     if ($queueId == NULL) {
         throw new \Exception("Cannot find queue: {$queueName}");
     }
     $hashCommand = $queueModel->getHashCommand($commandInstance, $queueId);
     if ($queueModel->hashCommandExists($hashCommand) == FALSE) {
         $commandId = $queueModel->pushCommandToQueue($commandInstance, $queueId);
         if ($launcherExecute == TRUE) {
             $this->launchWorker($queueName);
         }
         return $commandId;
     } else {
         return 0;
     }
     return NULL;
 }
 public function commandExists($commandId)
 {
     $queueModel = new StorkQueueModel($this->getEntityManager());
     return $queueModel->commandExists($commandId);
 }