/** * Add the task to the queue * * @param string $queue The queue to use * @param Lilmuckers_Queue_Model_Queue_Task $task The task to assign * * @return Lilmuckers_Queue_Model_Adapter_Beanstalk */ protected function _addToQueue($queue, Lilmuckers_Queue_Model_Queue_Task $task) { //load the default prioriy, delay and ttr data $_priority = is_null($task->getPriority()) ? $this->_priority : $task->getPriority(); $_delay = is_null($task->getDelay()) ? $this->_delay : $task->getDelay(); $_ttr = is_null($task->getTtr()) ? $this->_ttr : $task->getTtr(); //load the json string for the task $_data = $task->exportData(); //send this data to the beanstalkd server $this->getConnection()->useTube($queue)->put($_data, $_priority, $_delay, $_ttr); return $this; }
/** * Add the task to the queue * * @param string $queue The queue to use * @param Lilmuckers_Queue_Model_Queue_Task $task The task to assign * * @return Lilmuckers_Queue_Model_Adapter_Amazon */ protected function _addToQueue($queue, Lilmuckers_Queue_Model_Queue_Task $task) { //load the default prioriy, delay and ttr data $_delay = is_null($task->getDelay()) ? null : $task->getDelay(); //load the json string for the task $_data = $task->exportData(); //get the queue url for this task $_queueUrl = $this->_getQueueUrl($queue); //start building the task parameters $_params = array('QueueUrl' => $_queueUrl, 'MessageBody' => $_data); //if delay was specified: if ($_delay) { $_params['DelaySeconds'] = $_delay; } //send this data to the amazon sqs server $this->getConnection()->sendMessage($_params); return $this; }