/**
  * Add a job in the server queue
  */
 public function addAction()
 {
     $server = $this->_getParam("server");
     $data = $this->_getParam("data");
     $tube = $this->_getParam("tube");
     try {
         if (!$data) {
             throw new Exception("The data field must not be empty");
         }
         if (!$tube) {
             throw new Exception("The tube field must not be empty");
         }
         // Connect to the server
         $messageQueue = new Pheanstalk_Pheanstalk($server);
         $messageQueue->useTube($tube);
         $messageQueue->put($data);
         $response = "";
     } catch (Exception $e) {
         $this->getResponse()->setHttpResponseCode(500);
         $response = $e->getMessage();
     }
     // Send Json response
     $this->jsonHelper->sendJson($response);
     $this->jsonHelper->getResponse()->sendResponse();
 }
 /**
  * Puts a task string into the current
  * @param $data
  * @param int $priority
  * @param int $delay
  * @param int $timeToRun
  * @return $this
  */
 public function put($data, $priority = \Pheanstalk_PheanstalkInterface::DEFAULT_PRIORITY, $delay = \Pheanstalk_PheanstalkInterface::DEFAULT_DELAY, $timeToRun = \Pheanstalk_PheanstalkInterface::DEFAULT_TTR)
 {
     $this->pheanstalk->put($data, $priority, $delay, $timeToRun);
     return $this;
 }