Job.php 3.0 KB

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