blob: c856215570b8b4e633d8a28722ed6604f83b8795 [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 /**
36 * Release the job back into the queue.
37 *
38 * Accepts a delay specified in seconds.
39 *
40 * @param int $delay
41 * @return void
42 */
43 public function release($delay = 0);
44
45 /**
46 * Determine if the job was released back into the queue.
47 *
48 * @return bool
49 */
50 public function isReleased();
51
52 /**
53 * Delete the job from the queue.
54 *
55 * @return void
56 */
57 public function delete();
58
59 /**
60 * Determine if the job has been deleted.
61 *
62 * @return bool
63 */
64 public function isDeleted();
65
66 /**
67 * Determine if the job has been deleted or released.
68 *
69 * @return bool
70 */
71 public function isDeletedOrReleased();
72
73 /**
74 * Get the number of times the job has been attempted.
75 *
76 * @return int
77 */
78 public function attempts();
79
80 /**
81 * Determine if the job has been marked as a failure.
82 *
83 * @return bool
84 */
85 public function hasFailed();
86
87 /**
88 * Mark the job as "failed".
89 *
90 * @return void
91 */
92 public function markAsFailed();
93
94 /**
95 * Delete the job, call the "failed" method, and raise the failed job event.
96 *
97 * @param \Throwable|null $e
98 * @return void
99 */
100 public function fail($e = null);
101
102 /**
103 * Get the number of times to attempt a job.
104 *
105 * @return int|null
106 */
107 public function maxTries();
108
109 /**
110 * Get the maximum number of exceptions allowed, regardless of attempts.
111 *
112 * @return int|null
113 */
114 public function maxExceptions();
115
116 /**
117 * Get the number of seconds the job can run.
118 *
119 * @return int|null
120 */
121 public function timeout();
122
123 /**
124 * Get the timestamp indicating when the job should timeout.
125 *
126 * @return int|null
127 */
128 public function retryUntil();
129
130 /**
131 * Get the name of the queued job class.
132 *
133 * @return string
134 */
135 public function getName();
136
137 /**
138 * Get the resolved name of the queued job class.
139 *
140 * Resolves the name of "wrapped" jobs such as class-based handlers.
141 *
142 * @return string
143 */
144 public function resolveName();
145
146 /**
147 * Get the name of the connection the job belongs to.
148 *
149 * @return string
150 */
151 public function getConnectionName();
152
153 /**
154 * Get the name of the queue the job belongs to.
155 *
156 * @return string
157 */
158 public function getQueue();
159
160 /**
161 * Get the raw body string for the job.
162 *
163 * @return string
164 */
165 public function getRawBody();
166}