1 | <?php |
||
10 | class Subscriber |
||
11 | { |
||
12 | /** |
||
13 | * @var QueueReader |
||
14 | */ |
||
15 | protected $queueReader; |
||
16 | |||
17 | /** |
||
18 | * @var LoggerInterface |
||
19 | */ |
||
20 | protected $logger; |
||
21 | |||
22 | /** |
||
23 | * @var EventSubscriptor[] |
||
24 | */ |
||
25 | protected $subscriptors = []; |
||
26 | |||
27 | /** |
||
28 | * Subscriber constructor. |
||
29 | * @param QueueReader $queueReader |
||
30 | * @param LoggerInterface $logger |
||
31 | */ |
||
32 | public function __construct(QueueReader $queueReader, LoggerInterface $logger) |
||
37 | |||
38 | /** |
||
39 | * @param EventSubscriptor $eventSubscriptor |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function subscribe(EventSubscriptor $eventSubscriptor) |
||
47 | |||
48 | /** |
||
49 | * @param int $timeout |
||
50 | * @throws DomainEventException |
||
51 | * @throws \Cmp\Queues\Domain\Queue\Exception\ReaderException |
||
52 | */ |
||
53 | public function start($timeout=0) |
||
67 | |||
68 | /** |
||
69 | * @param int $timeout |
||
70 | * @throws DomainEventException |
||
71 | * @throws \Cmp\Queues\Domain\Queue\Exception\ReaderException |
||
72 | */ |
||
73 | public function batch($timeout=0) |
||
79 | |||
80 | /** |
||
81 | * @param DomainEvent $domainEvent |
||
82 | */ |
||
83 | public function notify(DomainEvent $domainEvent) |
||
92 | |||
93 | /** |
||
94 | * @return EventSubscriptor[] |
||
95 | */ |
||
96 | public function getSubscriptors() |
||
100 | |||
101 | /** |
||
102 | * @throws DomainEventException |
||
103 | */ |
||
104 | private function checkHasSubscriptors() |
||
110 | } |