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\oatbox\PhpSerializable; |
25 | use oat\tao\model\taskQueue\Queue\Broker\QueueBrokerInterface; |
26 | use oat\taoTaskQueue\model\Task\TaskInterface; |
27 | use Psr\Log\LoggerAwareInterface; |
28 | use Zend\ServiceManager\ServiceLocatorAwareInterface; |
29 | |
30 | /** |
31 | * Interface QueueInterface |
32 | * |
33 | * @deprecated Use \oat\tao\model\taskQueue\QueueInterface |
34 | * |
35 | * @author Gyula Szucs <gyula@taotesting.com> |
36 | */ |
37 | interface QueueInterface extends \Countable, LoggerAwareInterface, PhpSerializable, ServiceLocatorAwareInterface |
38 | { |
39 | /** |
40 | * @deprecated It will be removed in version 1.0.0. Use QueueDispatcherInterface::SERVICE_ID instead |
41 | */ |
42 | public const SERVICE_ID = 'taoTaskQueue/taskQueue'; |
43 | |
44 | /** |
45 | * @deprecated It will be removed in version 1.0.0 |
46 | */ |
47 | public const OPTION_QUEUE_BROKER = 'queue_broker'; |
48 | |
49 | /** |
50 | * QueueInterface constructor. |
51 | * |
52 | * @param string $name |
53 | * @param QueueBrokerInterface $broker |
54 | * @param int $weight |
55 | */ |
56 | public function __construct($name, QueueBrokerInterface $broker, $weight = 1); |
57 | |
58 | /** |
59 | * @return string |
60 | */ |
61 | public function __toString(); |
62 | |
63 | /** |
64 | * Initialize queue. |
65 | * |
66 | * @return void |
67 | */ |
68 | public function initialize(); |
69 | |
70 | /** |
71 | * Returns queue name. |
72 | * |
73 | * @return string |
74 | */ |
75 | public function getName(); |
76 | |
77 | /** |
78 | * Returns queue weight. |
79 | * |
80 | * @return int |
81 | */ |
82 | public function getWeight(); |
83 | |
84 | /** |
85 | * @param int $weight |
86 | * @return QueueInterface |
87 | */ |
88 | public function setWeight($weight); |
89 | |
90 | /** |
91 | * Publish a task to the queue. |
92 | * |
93 | * @param TaskInterface $task |
94 | * @param null|string $label Label for the task |
95 | * @return bool Is the task successfully enqueued? |
96 | */ |
97 | public function enqueue(TaskInterface $task, $label = null); |
98 | |
99 | /** |
100 | * Receive a task from the queue. |
101 | * |
102 | * @return null|TaskInterface |
103 | */ |
104 | public function dequeue(); |
105 | |
106 | /** |
107 | * Acknowledge that the task has been received and consumed. |
108 | * |
109 | * @param TaskInterface $task |
110 | */ |
111 | public function acknowledge(TaskInterface $task); |
112 | |
113 | /** |
114 | * Is the given queue a sync queue? |
115 | * |
116 | * @return bool |
117 | */ |
118 | public function isSync(); |
119 | |
120 | /** |
121 | * The amount of tasks that can be received in one pop by this queue. |
122 | * |
123 | * @return int |
124 | */ |
125 | public function getNumberOfTasksToReceive(); |
126 | |
127 | /** |
128 | * Set new broker. |
129 | * |
130 | * @param QueueBrokerInterface $broker |
131 | * @return QueueInterface |
132 | */ |
133 | public function setBroker(QueueBrokerInterface $broker); |
134 | |
135 | /** |
136 | * @return QueueBrokerInterface |
137 | */ |
138 | public function getBroker(); |
139 | } |