blob: 9efd17d14d928c7ef74387b14d4a6849c219eb40 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace Illuminate\Contracts\Queue;
4
5interface Job
6{
7 /**
8 * Get the UUID of the job.
9 *
10 * @return string|null
11 */
12 public function uuid();
13
14 /**
15 * Get the job identifier.
16 *
17 * @return string
18 */
19 public function getJobId();
20
21 /**
22 * Get the decoded body of the job.
23 *
24 * @return array
25 */
26 public function payload();
27
28 /**
29 * Fire the job.
30 *
31 * @return void
32 */
33 public function fire();
34
35 /**
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010036 * Release the job back into the queue after (n) seconds.
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020037 *
38 * @param int $delay
39 * @return void
40 */
41 public function release($delay = 0);
42
43 /**
44 * Determine if the job was released back into the queue.
45 *
46 * @return bool
47 */
48 public function isReleased();
49
50 /**
51 * Delete the job from the queue.
52 *
53 * @return void
54 */
55 public function delete();
56
57 /**
58 * Determine if the job has been deleted.
59 *
60 * @return bool
61 */
62 public function isDeleted();
63
64 /**
65 * Determine if the job has been deleted or released.
66 *
67 * @return bool
68 */
69 public function isDeletedOrReleased();
70
71 /**
72 * Get the number of times the job has been attempted.
73 *
74 * @return int
75 */
76 public function attempts();
77
78 /**
79 * Determine if the job has been marked as a failure.
80 *
81 * @return bool
82 */
83 public function hasFailed();
84
85 /**
86 * Mark the job as "failed".
87 *
88 * @return void
89 */
90 public function markAsFailed();
91
92 /**
93 * Delete the job, call the "failed" method, and raise the failed job event.
94 *
95 * @param \Throwable|null $e
96 * @return void
97 */
98 public function fail($e = null);
99
100 /**
101 * Get the number of times to attempt a job.
102 *
103 * @return int|null
104 */
105 public function maxTries();
106
107 /**
108 * Get the maximum number of exceptions allowed, regardless of attempts.
109 *
110 * @return int|null
111 */
112 public function maxExceptions();
113
114 /**
115 * Get the number of seconds the job can run.
116 *
117 * @return int|null
118 */
119 public function timeout();
120
121 /**
122 * Get the timestamp indicating when the job should timeout.
123 *
124 * @return int|null
125 */
126 public function retryUntil();
127
128 /**
129 * Get the name of the queued job class.
130 *
131 * @return string
132 */
133 public function getName();
134
135 /**
136 * Get the resolved name of the queued job class.
137 *
138 * Resolves the name of "wrapped" jobs such as class-based handlers.
139 *
140 * @return string
141 */
142 public function resolveName();
143
144 /**
145 * Get the name of the connection the job belongs to.
146 *
147 * @return string
148 */
149 public function getConnectionName();
150
151 /**
152 * Get the name of the queue the job belongs to.
153 *
154 * @return string
155 */
156 public function getQueue();
157
158 /**
159 * Get the raw body string for the job.
160 *
161 * @return string
162 */
163 public function getRawBody();
164}