Job.php 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. * @param int $delay
  27. * @return mixed
  28. */
  29. public function release($delay = 0);
  30. /**
  31. * Delete the job from the queue.
  32. *
  33. * @return void
  34. */
  35. public function delete();
  36. /**
  37. * Determine if the job has been deleted.
  38. *
  39. * @return bool
  40. */
  41. public function isDeleted();
  42. /**
  43. * Determine if the job has been deleted or released.
  44. *
  45. * @return bool
  46. */
  47. public function isDeletedOrReleased();
  48. /**
  49. * Get the number of times the job has been attempted.
  50. *
  51. * @return int
  52. */
  53. public function attempts();
  54. /**
  55. * Process an exception that caused the job to fail.
  56. *
  57. * @param \Throwable $e
  58. * @return void
  59. */
  60. public function failed($e);
  61. /**
  62. * Get the number of times to attempt a job.
  63. *
  64. * @return int|null
  65. */
  66. public function maxTries();
  67. /**
  68. * Get the number of seconds the job can run.
  69. *
  70. * @return int|null
  71. */
  72. public function timeout();
  73. /**
  74. * Get the timestamp indicating when the job should timeout.
  75. *
  76. * @return int|null
  77. */
  78. public function timeoutAt();
  79. /**
  80. * Get the name of the queued job class.
  81. *
  82. * @return string
  83. */
  84. public function getName();
  85. /**
  86. * Get the resolved name of the queued job class.
  87. *
  88. * Resolves the name of "wrapped" jobs such as class-based handlers.
  89. *
  90. * @return string
  91. */
  92. public function resolveName();
  93. /**
  94. * Get the name of the connection the job belongs to.
  95. *
  96. * @return string
  97. */
  98. public function getConnectionName();
  99. /**
  100. * Get the name of the queue the job belongs to.
  101. *
  102. * @return string
  103. */
  104. public function getQueue();
  105. /**
  106. * Get the raw body string for the job.
  107. *
  108. * @return string
  109. */
  110. public function getRawBody();
  111. }