File tree 3 files changed +34
-21
lines changed
3 files changed +34
-21
lines changed Original file line number Diff line number Diff line change 5
5
class JobQueued
6
6
{
7
7
/**
8
+ * The connection name.
9
+ *
10
+ * @var string
11
+ */
12
+ public $ connectionName ;
13
+
14
+ /**
15
+ * The job ID.
16
+ *
8
17
* @var string|int|null
9
18
*/
10
- public $ jobId ;
19
+ public $ id ;
11
20
12
21
/**
13
- * @var string|object
22
+ * The job instance.
23
+ *
24
+ * @var \Closure|string|object
14
25
*/
15
26
public $ job ;
16
27
17
28
/**
18
- * JobQueued constructor .
29
+ * Create a new event instance .
19
30
*
20
- * @param string|int|null $jobId
31
+ * @param string $connectionName
32
+ * @param string|int|null $id
21
33
* @param \Closure|string|object $job
22
34
* @return void
23
35
*/
24
- public function __construct ($ jobId , $ job )
36
+ public function __construct ($ connectionName , $ id , $ job )
25
37
{
26
- $ this ->jobId = $ jobId ;
38
+ $ this ->connectionName = $ connectionName ;
39
+ $ this ->id = $ id ;
27
40
$ this ->job = $ job ;
28
41
}
29
42
}
Original file line number Diff line number Diff line change @@ -317,6 +317,20 @@ protected function shouldDispatchAfterCommit($job)
317
317
return false ;
318
318
}
319
319
320
+ /**
321
+ * Raise the job queued event.
322
+ *
323
+ * @param string|int|null $jobId
324
+ * @param \Closure|string|object $job
325
+ * @return void
326
+ */
327
+ protected function raiseJobQueuedEvent ($ jobId , $ job )
328
+ {
329
+ if ($ this ->container ->bound ('events ' )) {
330
+ $ this ->container ['events ' ]->dispatch (new JobQueued ($ this ->connectionName , $ jobId , $ job ));
331
+ }
332
+ }
333
+
320
334
/**
321
335
* Get the connection name for the queue.
322
336
*
@@ -350,18 +364,4 @@ public function setContainer(Container $container)
350
364
{
351
365
$ this ->container = $ container ;
352
366
}
353
-
354
- /**
355
- * Raise the job queued event.
356
- *
357
- * @param string|int|null $jobId
358
- * @param \Closure|string|object $job
359
- * @return void
360
- */
361
- protected function raiseJobQueuedEvent ($ jobId , $ job )
362
- {
363
- if ($ this ->container ->bound ('events ' )) {
364
- $ this ->container ['events ' ]->dispatch (new JobQueued ($ jobId , $ job ));
365
- }
366
- }
367
367
}
Original file line number Diff line number Diff line change @@ -477,7 +477,7 @@ public function testPushJobQueuedEvent($driver)
477
477
$ events = m::mock (Dispatcher::class);
478
478
$ events ->shouldReceive ('dispatch ' )->withArgs (function (JobQueued $ jobQueued ) {
479
479
$ this ->assertInstanceOf (RedisQueueIntegrationTestJob::class, $ jobQueued ->job );
480
- $ this ->assertIsString (RedisQueueIntegrationTestJob::class, $ jobQueued ->jobId );
480
+ $ this ->assertIsString (RedisQueueIntegrationTestJob::class, $ jobQueued ->id );
481
481
482
482
return true ;
483
483
})->andReturnNull ()->once ();
You can’t perform that action at this time.
0 commit comments