SyncJob.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. namespace Illuminate\Queue\Jobs;
  3. use Illuminate\Container\Container;
  4. use Illuminate\Contracts\Queue\Job as JobContract;
  5. class SyncJob extends Job implements JobContract
  6. {
  7. /**
  8. * The class name of the job.
  9. *
  10. * @var string
  11. */
  12. protected $job;
  13. /**
  14. * The queue message data.
  15. *
  16. * @var string
  17. */
  18. protected $payload;
  19. /**
  20. * Create a new job instance.
  21. *
  22. * @param \Illuminate\Container\Container $container
  23. * @param string $payload
  24. * @param string $connectionName
  25. * @param string $queue
  26. * @return void
  27. */
  28. public function __construct(Container $container, $payload, $connectionName, $queue)
  29. {
  30. $this->queue = $queue;
  31. $this->payload = $payload;
  32. $this->container = $container;
  33. $this->connectionName = $connectionName;
  34. }
  35. /**
  36. * Release the job back into the queue.
  37. *
  38. * @param int $delay
  39. * @return void
  40. */
  41. public function release($delay = 0)
  42. {
  43. parent::release($delay);
  44. }
  45. /**
  46. * Get the number of times the job has been attempted.
  47. *
  48. * @return int
  49. */
  50. public function attempts()
  51. {
  52. return 1;
  53. }
  54. /**
  55. * Get the job identifier.
  56. *
  57. * @return string
  58. */
  59. public function getJobId()
  60. {
  61. return '';
  62. }
  63. /**
  64. * Get the raw body string for the job.
  65. *
  66. * @return string
  67. */
  68. public function getRawBody()
  69. {
  70. return $this->payload;
  71. }
  72. /**
  73. * Get the name of the queue the job belongs to.
  74. *
  75. * @return string
  76. */
  77. public function getQueue()
  78. {
  79. return 'sync';
  80. }
  81. }