1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace mcorten87\rabbitmq_api\jobs; |
4
|
|
|
|
5
|
|
|
use mcorten87\rabbitmq_api\objects\DeliveryMode; |
6
|
|
|
use mcorten87\rabbitmq_api\objects\ExchangeName; |
7
|
|
|
use mcorten87\rabbitmq_api\objects\Message; |
8
|
|
|
use mcorten87\rabbitmq_api\objects\RoutingKey; |
9
|
|
|
use mcorten87\rabbitmq_api\objects\RoutingKeyUnknown; |
10
|
|
|
use mcorten87\rabbitmq_api\objects\VirtualHost; |
11
|
|
|
|
12
|
|
|
class JobExchangePublish extends JobBase |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @var VirtualHost |
16
|
|
|
*/ |
17
|
|
|
private $virtualHost; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var ExchangeName |
21
|
|
|
*/ |
22
|
|
|
private $exchangeName; |
23
|
|
|
|
24
|
|
|
/** @var DeliveryMode */ |
25
|
|
|
private $deliveryMode; |
26
|
|
|
|
27
|
|
|
/** @var Message */ |
28
|
|
|
private $message; |
29
|
|
|
|
30
|
|
|
/** @var RoutingKey */ |
31
|
|
|
private $routingKey; |
32
|
|
|
|
33
|
|
|
/** @return VirtualHost */ |
34
|
4 |
|
public function getVirtualHost() : VirtualHost |
35
|
|
|
{ |
36
|
4 |
|
return $this->virtualHost; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return ExchangeName |
41
|
|
|
*/ |
42
|
4 |
|
public function getExchangeName() : ExchangeName |
43
|
|
|
{ |
44
|
4 |
|
return $this->exchangeName; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return Message |
49
|
|
|
*/ |
50
|
4 |
|
public function getMessage(): Message |
51
|
|
|
{ |
52
|
4 |
|
return $this->message; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return DeliveryMode |
57
|
|
|
*/ |
58
|
4 |
|
public function getDeliveryMode(): DeliveryMode |
59
|
|
|
{ |
60
|
4 |
|
return $this->deliveryMode; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return RoutingKey |
65
|
|
|
*/ |
66
|
4 |
|
public function getRoutingKey(): RoutingKey |
67
|
|
|
{ |
68
|
4 |
|
return $this->routingKey; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* JobExchangePublish constructor. |
73
|
|
|
* @param VirtualHost $virtualHost |
74
|
|
|
* @param ExchangeName $exchangeName |
75
|
|
|
* @param Message $message |
76
|
|
|
* @param DeliveryMode $deliveryMode |
77
|
|
|
* @param RoutingKey|null $routingKey |
78
|
|
|
*/ |
79
|
4 |
|
public function __construct( |
80
|
|
|
VirtualHost $virtualHost, |
81
|
|
|
ExchangeName $exchangeName, |
82
|
|
|
Message $message, |
83
|
|
|
DeliveryMode $deliveryMode, |
84
|
|
|
RoutingKey $routingKey = null |
85
|
|
|
) { |
86
|
4 |
|
if ($routingKey === null) { |
87
|
3 |
|
$routingKey = new RoutingKeyUnknown(); |
88
|
|
|
} |
89
|
|
|
|
90
|
4 |
|
$this->virtualHost = $virtualHost; |
91
|
4 |
|
$this->exchangeName = $exchangeName; |
92
|
4 |
|
$this->message = $message; |
93
|
|
|
|
94
|
4 |
|
$this->deliveryMode = $deliveryMode; |
95
|
4 |
|
$this->routingKey = $routingKey; |
96
|
4 |
|
} |
97
|
|
|
} |
98
|
|
|
|