Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
registry.php
1<?php
2
4
12use Bitrix\Calendar\Core\Base\SingletonTrait;
13use Bitrix\Calendar\Core\Queue;
14
16{
17 use SingletonTrait;
18
20 private array $listeners = [];
21
22 protected function __construct()
23 {
24 $this->init();
25 }
26
27 public function registerListener(int $queueId, Queue\Interfaces\Listener $listener)
28 {
29 $this->listeners[$queueId] = $listener;
30 }
31
32 public function getListenerByQueueId(int $queueId): ?Queue\Interfaces\Listener
33 {
34 return $this->listeners[$queueId] ?? null;
35 }
36
37 private function init()
38 {
39 $this->registerListener(
40 QueueRegistry::QUEUE_LIST['EventDelayedSync'],
41 new AgentListener(
42 new AgentEntity(
43 EventDelayedSyncAgent::class . '::runAgent();'
44 )
45 )
46
47 );
48 $this->registerListener(
49 QueueRegistry::QUEUE_LIST['DelayedSyncSection'],
50 new AgentListener(
51 new AgentEntity(
52 Queue\Agent\PushDelayedSectionAgent::class . '::runAgent();'
53 )
54 )
55 );
56 $this->registerListener(
57 QueueRegistry::QUEUE_LIST['DelayedSyncConnection'],
58 new AgentListener(
59 new AgentEntity(
60 Queue\Agent\PushDelayedConnectionAgent::class . '::runAgent();'
61 )
62 )
63 );
64
65 $this->registerListener(
66 QueueRegistry::QUEUE_LIST['Example'],
67 new AgentListener(
68 new AgentEntity(
69 ConsumerClientExample::class . '::runAgent();'
70 )
71 )
72 );
73
74 $this->registerListener(
75 QueueRegistry::QUEUE_LIST['EventsWithEntityAttendeesFind'],
76 new AgentListener(
77 new AgentEntity(
78 EventsWithEntityAttendeesFindAgent::class . '::runAgent();',
79 'calendar',
80 1,
81 )
82 )
83 );
84
85 $this->registerListener(
86 QueueRegistry::QUEUE_LIST['EventAttendeesUpdate'],
87 new AgentListener(
88 new AgentEntity(
89 EventAttendeesUpdateAgent::class . '::runAgent();',
90 'calendar',
91 1,
92 )
93 )
94 );
95
96 $this->registerListener(
97 QueueRegistry::QUEUE_LIST['SendingEmailNotification'],
98 new AgentListener(
99 new AgentEntity(
100 SendingEmailNotificationAgent::class . '::runAgent();',
101 'calendar',
102 1,
103 )
104 )
105 );
106 }
107}
registerListener(int $queueId, Queue\Interfaces\Listener $listener)
Definition registry.php:27