1 | <?php |
||
21 | class BatchQueue extends DatabaseQueue |
||
22 | { |
||
23 | /** |
||
24 | * The AWS Batch client. |
||
25 | * |
||
26 | * @var BatchClient |
||
27 | */ |
||
28 | protected $batch; |
||
29 | |||
30 | protected $jobDefinition; |
||
31 | |||
32 | 21 | public function __construct( |
|
44 | |||
45 | 6 | public function push($job, $data = '', $queue = null) |
|
50 | |||
51 | public function pushRaw($payload, $queue = null, array $options = []) |
||
55 | |||
56 | /** |
||
57 | * Get the display name for the given job. |
||
58 | * |
||
59 | * @param mixed $job |
||
60 | * @return string |
||
61 | */ |
||
62 | 6 | protected function getBatchDisplayName($job) |
|
63 | { |
||
64 | 6 | if (is_object($job)) { |
|
65 | 3 | return method_exists($job, 'displayName') |
|
66 | 3 | ? $job->displayName() : str_replace('\\', '_', (string)get_class($job)); |
|
67 | } else { |
||
68 | 3 | return is_string($job) ? explode('@', $job)[0] : null; |
|
69 | } |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * Push a raw payload to the database, then to AWS Batch, with a given delay. |
||
74 | * |
||
75 | * @param string|null $queue |
||
76 | * @param string $payload |
||
77 | * @param string $jobName |
||
78 | * |
||
79 | * @return int |
||
80 | */ |
||
81 | 6 | protected function pushToBatch($queue, $payload, $jobName) |
|
96 | |||
97 | 3 | public function getJobById($id, $queue) |
|
112 | |||
113 | /** |
||
114 | * Release the job, without deleting first from the Queue |
||
115 | * |
||
116 | * @param string $queue |
||
117 | * @param \StdClass $job |
||
118 | * @param int $delay |
||
119 | * |
||
120 | * @return int |
||
121 | * @throws UnsupportedException |
||
122 | */ |
||
123 | 6 | public function release($queue, $job, $delay) |
|
135 | |||
136 | 3 | public function pop($queue = null) |
|
141 | |||
142 | public function bulk($jobs, $data = '', $queue = null) |
||
147 | |||
148 | 3 | public function later($delay, $job, $data = '', $queue = null) |
|
152 | } |
||
153 |