1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of graze/queue. |
5
|
|
|
* |
6
|
|
|
* Copyright (c) 2015 Nature Delivered Ltd. <https://www.graze.com> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @license https://github.com/graze/queue/blob/master/LICENSE MIT |
12
|
|
|
* |
13
|
|
|
* @link https://github.com/graze/queue |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace Graze\Queue\Handler; |
17
|
|
|
|
18
|
|
|
use Graze\Queue\Adapter\AdapterInterface; |
19
|
|
|
use Graze\Queue\Message\MessageInterface; |
20
|
|
|
|
21
|
|
|
class EagerAcknowledgementHandler extends AbstractAcknowledgementHandler |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @param MessageInterface $message |
25
|
|
|
* @param AdapterInterface $adapter |
26
|
|
|
* @param mixed $result |
27
|
|
|
*/ |
28
|
5 |
|
protected function acknowledge( |
29
|
|
|
MessageInterface $message, |
30
|
|
|
AdapterInterface $adapter, |
31
|
|
|
$result = null |
32
|
|
|
) { |
33
|
5 |
|
$adapter->acknowledge([$message]); |
34
|
5 |
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param MessageInterface $message |
38
|
|
|
* @param AdapterInterface $adapter |
39
|
|
|
* @param int $duration |
40
|
|
|
*/ |
41
|
|
|
protected function extend( |
42
|
|
|
MessageInterface $message, |
43
|
|
|
AdapterInterface $adapter, |
44
|
|
|
$duration |
45
|
|
|
) { |
46
|
|
|
$adapter->extend([$message], $duration); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param MessageInterface $message |
51
|
|
|
* @param AdapterInterface $adapter |
52
|
|
|
* @param mixed $result |
53
|
|
|
*/ |
54
|
1 |
|
protected function reject( |
55
|
|
|
MessageInterface $message, |
56
|
|
|
AdapterInterface $adapter, |
57
|
|
|
$result = null |
58
|
|
|
) { |
59
|
1 |
|
$adapter->reject([$message]); |
60
|
1 |
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param AdapterInterface $adapter |
64
|
|
|
*/ |
65
|
6 |
|
protected function flush(AdapterInterface $adapter) |
66
|
|
|
{ |
67
|
|
|
// Nothing to flush |
68
|
6 |
|
} |
69
|
|
|
} |
70
|
|
|
|