1 | <?php |
||
16 | class MongoFailedJobProvider implements FailedJobProviderInterface |
||
17 | { |
||
18 | /** |
||
19 | * The database connection name. |
||
20 | * |
||
21 | * @var MongoDriverInterface |
||
22 | */ |
||
23 | protected $mongo; |
||
24 | |||
25 | /** |
||
26 | * The database collection. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $collection; |
||
31 | |||
32 | /** |
||
33 | * Create a new database failed job provider. |
||
34 | * |
||
35 | * @param MongoDriverInterface $mongo |
||
36 | * @param string $collection |
||
37 | */ |
||
38 | public function __construct(MongoDriverInterface $mongo, string $collection = 'queue_jobs_failed') |
||
43 | |||
44 | /** |
||
45 | * Log a failed job into storage. |
||
46 | * |
||
47 | * @param string $connection |
||
48 | * @param string $queue |
||
49 | * @param string $payload |
||
50 | * @param Exception $exception |
||
51 | * |
||
52 | * @return int|null|void |
||
53 | */ |
||
54 | public function log(string $connection, string $queue, string $payload, Exception $exception) |
||
64 | |||
65 | /** |
||
66 | * Get a list of all of the failed jobs. |
||
67 | * |
||
68 | * @return array |
||
69 | */ |
||
70 | public function all(): array |
||
83 | |||
84 | /** |
||
85 | * Get a single failed job. |
||
86 | * |
||
87 | * @param string $id |
||
88 | * |
||
89 | * @return Job |
||
90 | */ |
||
91 | public function find($id) |
||
97 | |||
98 | /** |
||
99 | * Delete a single failed job from storage. |
||
100 | * |
||
101 | * @param string $id |
||
102 | * |
||
103 | * @return bool |
||
104 | */ |
||
105 | public function forget($id) |
||
115 | |||
116 | /** |
||
117 | * Flush all of the failed jobs from storage. |
||
118 | */ |
||
119 | public function flush() |
||
123 | |||
124 | /** |
||
125 | * Get a new query builder instance for the collection. |
||
126 | * |
||
127 | * @return Collection mongo collection |
||
128 | */ |
||
129 | protected function getCollection(): Collection |
||
133 | |||
134 | /** |
||
135 | * Build job from database data |
||
136 | * |
||
137 | * @param $data |
||
138 | * |
||
139 | * @return Job |
||
140 | */ |
||
141 | protected function buildJob($data): Job |
||
153 | } |
||
154 |