1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Umbrellio\Jaravel\Services\Job; |
6
|
|
|
|
7
|
|
|
use Illuminate\Contracts\Bus\Dispatcher; |
8
|
|
|
use Illuminate\Contracts\Bus\QueueingDispatcher; |
9
|
|
|
|
10
|
|
|
class JobWithTracingInjectionDispatcher implements QueueingDispatcher |
11
|
|
|
{ |
12
|
|
|
private Dispatcher $dispatcher; |
13
|
|
|
private JobInjectionMaker $injectionMaker; |
14
|
|
|
|
15
|
|
|
public function __construct(QueueingDispatcher $dispatcher, JobInjectionMaker $injectionMaker) |
16
|
|
|
{ |
17
|
|
|
$this->dispatcher = $dispatcher; |
18
|
|
|
$this->injectionMaker = $injectionMaker; |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function dispatchNow($command, $handler = null) |
22
|
|
|
{ |
23
|
|
|
return $this->dispatcher->dispatchNow($this->injectionMaker->injectParentSpanToCommand($command), $handler); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function dispatchToQueue($command) |
27
|
|
|
{ |
28
|
|
|
return $this->dispatcher->dispatchToQueue($this->injectionMaker->injectParentSpanToCommand($command)); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function dispatch($command) |
32
|
|
|
{ |
33
|
|
|
return $this->dispatcher->dispatch($this->injectionMaker->injectParentSpanToCommand($command)); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function dispatchSync($command, $handler = null) |
37
|
|
|
{ |
38
|
|
|
return $this->dispatcher->dispatchSync($this->injectionMaker->injectParentSpanToCommand($command)); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function hasCommandHandler($command) |
42
|
|
|
{ |
43
|
|
|
return $this->dispatcher->hasCommandHandler($command); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getCommandHandler($command) |
47
|
|
|
{ |
48
|
|
|
return $this->dispatcher->getCommandHandler($command); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function pipeThrough(array $pipes) |
52
|
|
|
{ |
53
|
|
|
return $this->dispatcher->pipeThrough($pipes); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function map(array $map) |
57
|
|
|
{ |
58
|
|
|
return $this->dispatcher->map($map); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function findBatch(string $batchId) |
62
|
|
|
{ |
63
|
|
|
return $this->dispatcher->findBatch($batchId); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function batch($jobs) |
67
|
|
|
{ |
68
|
|
|
return $this->dispatcher->batch($jobs); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function chain($jobs) |
72
|
|
|
{ |
73
|
|
|
return $this->dispatcher->chain($jobs); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|