1 | <?php |
||
8 | class Consumer |
||
9 | { |
||
10 | /** |
||
11 | * @var QueueReader |
||
12 | */ |
||
13 | protected $queueReader; |
||
14 | |||
15 | /** |
||
16 | * Consumer constructor. |
||
17 | * @param QueueReader $queueReader |
||
18 | */ |
||
19 | public function __construct(QueueReader $queueReader) |
||
23 | |||
24 | /** |
||
25 | * Consumes tasks indefinitely in a blocking manner |
||
26 | * @param callable $callback Callable that'll be invoked when a message is received |
||
27 | * @param int $timeout (optional) If specified, the process will block a max of $timeout seconds. Indefinitely if 0 |
||
28 | */ |
||
29 | public function consume(callable $callback, $timeout=0) |
||
41 | |||
42 | /** |
||
43 | * Purges all messages from the queue |
||
44 | */ |
||
45 | public function purge() |
||
49 | } |