1 | <?php declare(strict_types = 1); |
||
9 | trait CircuitBreakerAwareTrait |
||
10 | { |
||
11 | /** |
||
12 | * @var CircuitBreakerService |
||
13 | */ |
||
14 | private $circuitBreaker; |
||
15 | |||
16 | /** |
||
17 | * @var EventDispatcherInterface |
||
18 | */ |
||
19 | private $eventDispatcher; |
||
20 | |||
21 | /** |
||
22 | * Set the circuit breaker service |
||
23 | * |
||
24 | * @param CircuitBreakerService $circuitBreaker |
||
25 | */ |
||
26 | 1 | public function setCircuitBreaker(CircuitBreakerService $circuitBreaker) |
|
30 | |||
31 | /** |
||
32 | * @param EventDispatcherInterface $eventDispatcher |
||
33 | */ |
||
34 | 1 | public function setEventDispatcher(EventDispatcherInterface $eventDispatcher) |
|
38 | |||
39 | |||
40 | /** |
||
41 | * Send an event to notify the circuit breaker that a given service is down |
||
42 | * |
||
43 | * @param string $serviceName The service which is down |
||
44 | */ |
||
45 | 2 | public function notifyServiceIsDown(string $serviceName) |
|
52 | |||
53 | /** |
||
54 | * Send an event to notify the circuit breaker that a given service is up |
||
55 | * |
||
56 | * @param string $serviceName The service which is up |
||
57 | */ |
||
58 | public function notifyServiceIsUp(string $serviceName) |
||
65 | } |
||
66 |