1 | <?php |
||
10 | class DoctrineProvider extends AbstractProvider |
||
11 | { |
||
12 | |||
13 | protected $em; |
||
14 | protected $repository; |
||
15 | |||
16 | /** |
||
17 | * Constructor for Provider classes |
||
18 | * |
||
19 | * @param string $name Name of the Queue the provider is for |
||
20 | * @param array $options An array of configuration options for the Queue |
||
21 | * @param mixed $client A Queue Client for the provider |
||
22 | * @param Cache $cache An instance of Doctrine\Common\Cache\Cache |
||
23 | * @param Logger $logger An instance of Symfony\Bridge\Mongolog\Logger |
||
24 | */ |
||
25 | public function __construct($name, array $options, $client, Cache $cache, Logger $logger) |
||
34 | |||
35 | /** |
||
36 | * Returns the name of the Queue that this Provider is for |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | public function getName() |
||
44 | |||
45 | /** |
||
46 | * Returns the Queue Provider name |
||
47 | * |
||
48 | * @return string |
||
49 | */ |
||
50 | public function getProvider() |
||
54 | |||
55 | /** |
||
56 | * Returns the Provider's Configuration Options |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | public function getOptions() |
||
64 | |||
65 | /** |
||
66 | * Returns the Cache service |
||
67 | * |
||
68 | * @return Cache |
||
69 | */ |
||
70 | public function getCache() |
||
74 | |||
75 | /** |
||
76 | * Returns the Logger service |
||
77 | * |
||
78 | * @return Logger |
||
79 | */ |
||
80 | public function getLogger() |
||
84 | |||
85 | /** |
||
86 | * Get repository |
||
87 | * |
||
88 | * @return array |
||
89 | */ |
||
90 | public function getRepository() |
||
97 | |||
98 | /** |
||
99 | * Creates the Queue |
||
100 | * |
||
101 | * All Create methods are idempotent, if the resource exists, the current ARN |
||
102 | * will be returned |
||
103 | */ |
||
104 | public function create() |
||
108 | |||
109 | /** |
||
110 | * Publishes a message to the Queue |
||
111 | * |
||
112 | * This method should return a string MessageId or Response |
||
113 | * |
||
114 | * @param array $message The message to queue |
||
115 | * @param array $options An array of options that override the queue defaults |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | public function publish(array $message, array $options = []) |
||
136 | |||
137 | /** |
||
138 | * Polls the Queue for Messages |
||
139 | * |
||
140 | * Depending on the Provider, this method may keep the connection open for |
||
141 | * a configurable amount of time, to allow for long polling. In most cases, |
||
142 | * this method is not meant to be used to long poll indefinitely, but should |
||
143 | * return in reasonable amount of time |
||
144 | * |
||
145 | * @param array $options An array of options that override the queue defaults |
||
146 | * |
||
147 | * @return array |
||
148 | */ |
||
149 | public function receive(array $options = []) |
||
173 | |||
174 | /** |
||
175 | * Deletes the Queue Message |
||
176 | * |
||
177 | * @param mixed $id A message identifier or resource |
||
178 | */ |
||
179 | public function delete($id) |
||
185 | |||
186 | /** |
||
187 | * Destroys a Queue and clears any Queue related Cache |
||
188 | * |
||
189 | * @return bool |
||
190 | */ |
||
191 | public function destroy() |
||
199 | |||
200 | /** |
||
201 | * Returns a specific message |
||
202 | * |
||
203 | * @param integer $id |
||
204 | * |
||
205 | * @return Message |
||
206 | */ |
||
207 | public function getById($id) |
||
211 | |||
212 | /* |
||
213 | * Returns a query of the message queue |
||
214 | * |
||
215 | * @param string $contains |
||
216 | * @param DateTime $from |
||
217 | * @param DateTime $to |
||
218 | * |
||
219 | * @return Query |
||
220 | */ |
||
221 | |||
222 | public function findBy($contains = null, $from = null, $to = null) |
||
247 | } |
||
248 |