Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2017 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\taoTaskQueue\model; |
| 23 | |
| 24 | use oat\taoTaskQueue\model\Task\TaskInterface; |
| 25 | use Psr\Log\LoggerAwareInterface; |
| 26 | |
| 27 | /** |
| 28 | * Interface WorkerInterface |
| 29 | * |
| 30 | * @deprecated Use \oat\tao\model\taskQueue\Worker\WorkerInterface |
| 31 | * |
| 32 | * @author Gyula Szucs <gyula@taotesting.com> |
| 33 | */ |
| 34 | interface WorkerInterface extends LoggerAwareInterface |
| 35 | { |
| 36 | /** |
| 37 | * @param QueueDispatcherInterface $queueService |
| 38 | * @param TaskLogInterface $taskLog |
| 39 | * @param bool $handleSignals |
| 40 | */ |
| 41 | public function __construct(QueueDispatcherInterface $queueService, TaskLogInterface $taskLog, $handleSignals); |
| 42 | |
| 43 | /** |
| 44 | * Start processing tasks from a given queue |
| 45 | * |
| 46 | * @return void |
| 47 | */ |
| 48 | public function run(); |
| 49 | |
| 50 | /** |
| 51 | * Process a task |
| 52 | * |
| 53 | * @param TaskInterface $task |
| 54 | * @return string Status of the task after process |
| 55 | */ |
| 56 | public function processTask(TaskInterface $task); |
| 57 | |
| 58 | /** |
| 59 | * Set the maximum iterations for the worker. If nothing is set, the worker runs infinitely. |
| 60 | * @deprecated |
| 61 | * |
| 62 | * @param int $maxIterations |
| 63 | * @return WorkerInterface |
| 64 | */ |
| 65 | public function setMaxIterations($maxIterations); |
| 66 | |
| 67 | /** |
| 68 | * Sets a queue on which the worker operates exclusively. |
| 69 | * |
| 70 | * @param QueueInterface $queue |
| 71 | * @param int $maxIterations |
| 72 | * |
| 73 | * @return WorkerInterface |
| 74 | */ |
| 75 | public function setDedicatedQueue(QueueInterface $queue, $maxIterations = 0); |
| 76 | } |