Job.php 3.0 KB

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