1 | <?php |
||
28 | class Dispatcher implements LoggerAwareInterface |
||
29 | { |
||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | private $connectionPool; |
||
34 | |||
35 | /** |
||
36 | * @var ServiceClientFactory |
||
37 | */ |
||
38 | private $clientFactory; |
||
39 | |||
40 | /** |
||
41 | * @var NotificationBuilder |
||
42 | */ |
||
43 | private $notificationBuilder; |
||
44 | |||
45 | /** |
||
46 | * @var ResponseHandler |
||
47 | */ |
||
48 | private $responseHandler; |
||
49 | |||
50 | /** |
||
51 | * @var LoggerInterface |
||
52 | */ |
||
53 | private $logger; |
||
54 | |||
55 | /** |
||
56 | * @param ServiceClientFactory $clientFactory |
||
57 | * @param NotificationBuilder $notificationBuilder |
||
58 | * @param ResponseHandler $responseHandler |
||
59 | */ |
||
60 | public function __construct( |
||
71 | |||
72 | /** |
||
73 | * @param LoggerInterface $logger |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function setLogger(LoggerInterface $logger) |
||
81 | |||
82 | /** |
||
83 | * @param bool $isDevelopment |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function setDevelopmentMode($isDevelopment) |
||
91 | |||
92 | /** |
||
93 | * Gets a service client connection by service name |
||
94 | * |
||
95 | * @param string $serviceName |
||
96 | * @return ServiceClientInterface |
||
97 | */ |
||
98 | public function getConnection($serviceName) |
||
106 | |||
107 | /** |
||
108 | * Initialize service client connection by service name |
||
109 | * |
||
110 | * @param string $serviceName |
||
111 | * @return $this |
||
112 | */ |
||
113 | public function initConnection($serviceName) |
||
120 | |||
121 | /** |
||
122 | * Creates a feedback service connection |
||
123 | * |
||
124 | * @param string $serviceName |
||
125 | * @return ServiceClientInterface |
||
126 | */ |
||
127 | public function initFeedbackConnection($serviceName) |
||
131 | |||
132 | /** |
||
133 | * @return ResponseHandler |
||
134 | */ |
||
135 | public function getResponseHandler() |
||
139 | |||
140 | /** |
||
141 | * Tries to dispatch all messages to notification service |
||
142 | * |
||
143 | * @param MessageInterface $message |
||
144 | */ |
||
145 | public function dispatch(MessageInterface $message) |
||
174 | |||
175 | /** |
||
176 | * Tries to connect and load feedback data |
||
177 | * |
||
178 | * @return $this |
||
179 | * @throws RuntimeException |
||
180 | * @throws \Exception |
||
181 | */ |
||
182 | public function loadFeedback() |
||
210 | |||
211 | /** |
||
212 | * Tries to connect and send a message to notification service |
||
213 | * |
||
214 | * @param string $messageIdentifier |
||
215 | */ |
||
216 | private function sendNotifications($messageIdentifier) |
||
230 | } |
||
231 |