55use Illuminate \Container \Container ;
66use Illuminate \Contracts \Encryption \Encrypter ;
77use Illuminate \Contracts \Queue \Job as JobContract ;
8- use Illuminate \Queue \Events \JobExceptionOccurred ;
9- use Illuminate \Queue \Events \JobFailed ;
10- use Illuminate \Queue \Events \JobProcessed ;
11- use Illuminate \Queue \Events \JobProcessing ;
12- use Illuminate \Queue \Events \JobQueued ;
8+ use Illuminate \Queue \Events as QueueEvents ;
139use Illuminate \Support \Carbon ;
1410use romanzipp \QueueMonitor \Enums \MonitorStatus ;
1511use romanzipp \QueueMonitor \Models \Contracts \MonitorContract ;
1612use romanzipp \QueueMonitor \Traits \IsMonitored ;
1713
1814class QueueMonitor
1915{
20- private const TIMESTAMP_EXACT_FORMAT = 'Y-m-d H:i:s.u ' ;
16+ private const string TIMESTAMP_EXACT_FORMAT = 'Y-m-d H:i:s.u ' ;
2117
2218 public static string $ model ;
2319
@@ -31,14 +27,7 @@ public static function getModel(): MonitorContract
3127 return new self::$ model ();
3228 }
3329
34- /**
35- * Handle Job Queued.
36- *
37- * @param JobQueued $event
38- *
39- * @return void
40- */
41- public static function handleJobQueued (JobQueued $ event ): void
30+ public static function handleJobQueued (QueueEvents \JobQueued $ event ): void
4231 {
4332 self ::jobQueued ($ event );
4433 }
@@ -53,50 +42,22 @@ public static function handleJobPushed($event): void
5342 self ::jobPushed ($ event );
5443 }
5544
56- /**
57- * Handle Job Processing.
58- *
59- * @param JobProcessing $event
60- *
61- * @return void
62- */
63- public static function handleJobProcessing (JobProcessing $ event ): void
45+ public static function handleJobProcessing (QueueEvents \JobProcessing $ event ): void
6446 {
6547 self ::jobStarted ($ event ->job );
6648 }
6749
68- /**
69- * Handle Job Processed.
70- *
71- * @param JobProcessed $event
72- *
73- * @return void
74- */
75- public static function handleJobProcessed (JobProcessed $ event ): void
50+ public static function handleJobProcessed (QueueEvents \JobProcessed $ event ): void
7651 {
7752 self ::jobFinished ($ event ->job , MonitorStatus::SUCCEEDED );
7853 }
7954
80- /**
81- * Handle Job Failing.
82- *
83- * @param JobFailed $event
84- *
85- * @return void
86- */
87- public static function handleJobFailed (JobFailed $ event ): void
55+ public static function handleJobFailed (QueueEvents \JobFailed $ event ): void
8856 {
8957 self ::jobFinished ($ event ->job , MonitorStatus::FAILED , $ event ->exception );
9058 }
9159
92- /**
93- * Handle Job Exception Occurred.
94- *
95- * @param JobExceptionOccurred $event
96- *
97- * @return void
98- */
99- public static function handleJobExceptionOccurred (JobExceptionOccurred $ event ): void
60+ public static function handleJobExceptionOccurred (QueueEvents \JobExceptionOccurred $ event ): void
10061 {
10162 self ::jobFinished ($ event ->job , MonitorStatus::FAILED , $ event ->exception );
10263 }
@@ -120,11 +81,11 @@ public static function getJobId(JobContract $job): string
12081 /**
12182 * Start Queue Monitoring for Job.
12283 *
123- * @param JobQueued $event
84+ * @param QueueEvents\ JobQueued $event
12485 *
12586 * @return void
12687 */
127- protected static function jobQueued (JobQueued $ event ): void
88+ protected static function jobQueued (QueueEvents \ JobQueued $ event ): void
12889 {
12990 if ( ! self ::shouldBeMonitored ($ event ->job )) {
13091 return ;
0 commit comments