Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
handler.php
1<?php
2
4
5abstract class Handler
6{
7 const WORK_GROUP_TYPE = 'project';
8 const DEPARTMENT_TYPE = 'department';
9 const ALL_USERS_TYPE = 'all-users';
10
11 protected static array $storedData = [];
12
17 protected static function sendBatchOfMessagesToQueue(array $data): void
18 {
19 $messages = [];
20 foreach ($data as $datum)
21 {
22 if (!empty($datum['entityType']) && !empty($datum['entityId']))
23 {
24 $messages[] = (new \Bitrix\Calendar\Core\Queue\Message\Message())
25 ->setBody([
26 'entityType' => $datum['entityType'],
27 'entityId' => $datum['entityId'],
28 ])
29 ->setRoutingKey('calendar:find_events_with_entity_attendees')
30 ;
31 }
32 }
33
34 (new \Bitrix\Calendar\Core\Queue\Producer\Producer())->sendBatch($messages);
35 }
36
42 protected static function sendMessageToQueue(string $entityType, $entityId = null): void
43 {
44 $message = (new \Bitrix\Calendar\Core\Queue\Message\Message())
45 ->setBody([
46 'entityType' => $entityType,
47 'entityId' => $entityId,
48 ])
49 ->setRoutingKey('calendar:find_events_with_entity_attendees')
50 ;
51
52 (new \Bitrix\Calendar\Core\Queue\Producer\Producer())->send($message);
53 }
54}
static sendMessageToQueue(string $entityType, $entityId=null)
Definition handler.php:42