ActivityHandler.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Jobs\InboxPipeline;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Contracts\Queue\ShouldBeUnique;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use Illuminate\Foundation\Bus\Dispatchable;
  7. use Illuminate\Queue\InteractsWithQueue;
  8. use Illuminate\Queue\SerializesModels;
  9. use App\Util\ActivityPub\Inbox;
  10. class ActivityHandler implements ShouldQueue
  11. {
  12. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  13. protected $username;
  14. protected $headers;
  15. protected $payload;
  16. public $timeout = 300;
  17. public $tries = 1;
  18. public $maxExceptions = 1;
  19. /**
  20. * Create a new job instance.
  21. *
  22. * @return void
  23. */
  24. public function __construct($headers, $username, $payload)
  25. {
  26. $this->username = $username;
  27. $this->headers = $headers;
  28. $this->payload = $payload;
  29. }
  30. /**
  31. * Execute the job.
  32. *
  33. * @return void
  34. */
  35. public function handle()
  36. {
  37. (new Inbox($this->headers, $this->username, $this->payload))->handle();
  38. return;
  39. }
  40. }