Job.php 2.8 KB

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