@@ -11,6 +11,9 @@ |
||
11 | 11 | protected $dm; |
12 | 12 | protected $documentName; |
13 | 13 | |
14 | + /** |
|
15 | + * @param string $documentName |
|
16 | + */ |
|
14 | 17 | public function __construct(DocumentManager $dm, $documentName) |
15 | 18 | { |
16 | 19 | $this->dm = $dm; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
19 | - * @param field_type $jobClass |
|
19 | + * @param string $jobClass |
|
20 | 20 | */ |
21 | 21 | public function setJobClass($jobClass) |
22 | 22 | { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * @return the $jobManager |
|
32 | + * @return JobManagerInterface $jobManager |
|
33 | 33 | */ |
34 | 34 | public function getJobManager() |
35 | 35 | { |
@@ -53,6 +53,9 @@ discard block |
||
53 | 53 | return new $this->jobClass($this, $batch, $priority, $dateTime); |
54 | 54 | } |
55 | 55 | |
56 | + /** |
|
57 | + * @param integer $priority |
|
58 | + */ |
|
56 | 59 | public function later($delay = 0, $priority = null) |
57 | 60 | { |
58 | 61 | $job = $this->at(time() + $delay, false, $priority); |
@@ -60,6 +63,9 @@ discard block |
||
60 | 63 | return $job; |
61 | 64 | } |
62 | 65 | |
66 | + /** |
|
67 | + * @param integer $priority |
|
68 | + */ |
|
63 | 69 | public function batchLater($delay = 0, $priority = null) |
64 | 70 | { |
65 | 71 | $job = $this->at($delay, true, $priority); |
@@ -67,6 +73,10 @@ discard block |
||
67 | 73 | return $job; |
68 | 74 | } |
69 | 75 | |
76 | + /** |
|
77 | + * @param integer $time |
|
78 | + * @param integer $priority |
|
79 | + */ |
|
70 | 80 | public function batchAt($time = null, $priority = null) |
71 | 81 | { |
72 | 82 | return $this->at($time, true, $priority); |
@@ -33,6 +33,9 @@ |
||
33 | 33 | return $job; |
34 | 34 | } |
35 | 35 | |
36 | + /** |
|
37 | + * @param string $workerName |
|
38 | + */ |
|
36 | 39 | public function getJob($workerName = null, $methodName = null, $prioritize = true) |
37 | 40 | { |
38 | 41 | if ($methodName) { |
@@ -15,12 +15,12 @@ |
||
15 | 15 | |
16 | 16 | public function __construct(AMQPConnection $connection) { |
17 | 17 | $this->connection = $connection; |
18 | - $this->channel = $connection->channel();; |
|
18 | + $this->channel = $connection->channel(); ; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function save($job) { |
22 | 22 | $queue = $job->getWorkerName(); |
23 | - $exchange = null; // User default exchange |
|
23 | + $exchange = null; // User default exchange |
|
24 | 24 | |
25 | 25 | $this->channel->queue_declare($queue, false, true, false, false); |
26 | 26 | $this->channel->exchange_declare($exchange, 'direct', false, true, false); |
@@ -104,6 +104,11 @@ |
||
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | + /** |
|
108 | + * @param integer|null $time |
|
109 | + * @param string $method |
|
110 | + * @param integer $priority |
|
111 | + */ |
|
107 | 112 | protected function assertJob(Job $job, $time, $method, $priority = null) { |
108 | 113 | $this->assertNotEmpty($job->getId(), "Job should have an id"); |
109 | 114 |
@@ -68,7 +68,7 @@ |
||
68 | 68 | set_time_limit($processTimeout); // Set an hour timeout |
69 | 69 | |
70 | 70 | if ($jobId = $input->getOption('job_id')) { |
71 | - return $this->runJobById($jobId); // Run a single job |
|
71 | + return $this->runJobById($jobId); // Run a single job |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | try { |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $container->setParameter('dtc_queue.job_class', $documentName); |
24 | 24 | |
25 | 25 | // Load Grid if Dtc\GridBundle Bundle is registered |
26 | - $yamlLoader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
26 | + $yamlLoader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
27 | 27 | |
28 | 28 | $yamlLoader->load('queue.yml'); |
29 | 29 | $yamlLoader->load('grid.yml'); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public function hasListeners($eventName) |
17 | 17 | { |
18 | - if ( ! isset($this->listeners[$eventName])) { |
|
18 | + if (!isset($this->listeners[$eventName])) { |
|
19 | 19 | return false; |
20 | 20 | } |
21 | 21 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | public function dispatch($eventName, Event $event) |
26 | 26 | { |
27 | - if ( ! isset($this->listeners[$eventName])) { |
|
27 | + if (!isset($this->listeners[$eventName])) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->logger->debug("No job to run"); |
52 | 52 | } |
53 | 53 | |
54 | - return; // no job to run |
|
54 | + return; // no job to run |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return $this->runJob($job); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | $job->setStatus(Job::STATUS_ERROR); |
83 | - $job->setMessage($e->getMessage() . "\n" .$e->getTraceAsString()); |
|
83 | + $job->setMessage($e->getMessage() . "\n" . $e->getTraceAsString()); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // save Job history |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | $documentName = 'Dtc\QueueBundle\Documents\Job'; |
50 | 50 | $sm = self::$dm->getSchemaManager(); |
51 | - $timeout = 1000; |
|
51 | + $timeout = 1000; |
|
52 | 52 | |
53 | 53 | $sm->dropDocumentCollection($documentName); |
54 | 54 | $sm->createDocumentCollection($documentName); |