/** * @param \Illuminate\Database\Connection $database * @param string $table * @param string $default * @param int $expire */ public function __construct(Connection $database, $table, $default = 'default', $expire = 60) { parent::__construct($database, $table, $default, $expire); // TODO: support options (timeout, replica set, customizable write concern level) $dsn = $database->getConfig('dsn'); $options = array("journal" => true, "w" => MongoDB\Driver\WriteConcern::MAJORITY); $driverOptions = array(); $this->client = new MongoDB\Client($dsn, $options, $driverOptions); $this->databaseName = $database->getConfig('database'); }
/** * Delete the job from the queue. * * @return void */ public function delete() { parent::delete(); $this->database->deleteReserved($this->queue, $this->job->id); }
/** * Release the job back into the queue. * * @param int $delay * @return void */ public function release($delay = 0) { parent::release($delay); $this->delete(); $this->database->release($this->queue, $this->job, $delay); }
/** * Set the IoC container instance. * * @param \Illuminate\Container\Container $container * @return void * @static */ public static function setContainer($container) { //Method inherited from \Illuminate\Queue\Queue \Illuminate\Queue\DatabaseQueue::setContainer($container); }
/** * Push a new job onto the queue after a delay. * * @param \DateTime|int $delay * @param string $job * @param mixed $data * @param string|null $queue * * @return int */ public function later($delay, $job, $data = '', $queue = null) { $id = parent::later($delay, $job, $data, $queue); $this->startProcess($id); return $id; }
/** * Set the encrypter instance. * * @param \Illuminate\Contracts\Encryption\Encrypter $crypt * @return void * @static */ public static function setEncrypter($crypt) { //Method inherited from \Illuminate\Queue\Queue \Illuminate\Queue\DatabaseQueue::setEncrypter($crypt); }