Build Reactive Signals for Bluesky's AT Protocol Firehose in Laravel
1<?php
2
3namespace SocialDept\AtpSignals\Jobs;
4
5use Illuminate\Bus\Queueable;
6use Illuminate\Contracts\Queue\ShouldQueue;
7use Illuminate\Foundation\Bus\Dispatchable;
8use Illuminate\Queue\InteractsWithQueue;
9use Illuminate\Queue\SerializesModels;
10use SocialDept\AtpSignals\Events\SignalEvent;
11use SocialDept\AtpSignals\Signals\Signal;
12
13class ProcessSignalJob implements ShouldQueue
14{
15 use Dispatchable;
16 use InteractsWithQueue;
17 use Queueable;
18 use SerializesModels;
19
20 public function __construct(
21 protected Signal $signal,
22 protected SignalEvent $event,
23 ) {
24 }
25
26 public function handle(): void
27 {
28 $this->signal->handle($this->event);
29 }
30
31 public function failed(\Throwable $exception): void
32 {
33 $this->signal->failed($this->event, $exception);
34 }
35}