1 | <?php |
||
12 | abstract class Job implements Message |
||
13 | { |
||
14 | const DEFAULT_MAX_RETRIES = 10; |
||
15 | |||
16 | /** |
||
17 | * @var int |
||
18 | */ |
||
19 | protected $delay = 0; |
||
20 | |||
21 | /** |
||
22 | * @var int |
||
23 | */ |
||
24 | protected $retries = 0; |
||
25 | |||
26 | /** |
||
27 | * @var int |
||
28 | */ |
||
29 | protected $maxRetries = self::DEFAULT_MAX_RETRIES; |
||
30 | |||
31 | /** |
||
32 | * @var string? |
||
33 | */ |
||
34 | protected $preferredQueueName; |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public final function getName() |
||
45 | |||
46 | /** |
||
47 | * Get delay |
||
48 | * |
||
49 | * @return int |
||
50 | */ |
||
51 | public function getDelay() |
||
55 | |||
56 | /** |
||
57 | * With delay (in seconds) |
||
58 | * |
||
59 | * @param int $delay Delay |
||
60 | * |
||
61 | * @return void |
||
62 | */ |
||
63 | public function withDelay($delay = 0) |
||
67 | |||
68 | /** |
||
69 | * Increment retries, step one |
||
70 | * |
||
71 | * @return void |
||
72 | */ |
||
73 | public function incrementRetries() |
||
83 | |||
84 | /** |
||
85 | * Total retries |
||
86 | * |
||
87 | * @return int |
||
88 | */ |
||
89 | public function getRetries() |
||
93 | |||
94 | /** |
||
95 | * Are retries exhausted? |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | public function areRetriesExhausted() |
||
103 | |||
104 | /** |
||
105 | * Max retries |
||
106 | * |
||
107 | * @return int |
||
108 | */ |
||
109 | public function getMaxRetries() |
||
113 | |||
114 | /** |
||
115 | * @param int $maxRetries |
||
116 | * |
||
117 | * @return int |
||
118 | */ |
||
119 | public function withMaxRetries($maxRetries) |
||
123 | |||
124 | public function getPreferredQueueName() |
||
128 | |||
129 | public function hasPreferredQueue() |
||
133 | |||
134 | public function withPreferredQueueName($preferredQueueName) |
||
138 | } |