Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
processorexample.php
1
<?php
2
3
namespace
Bitrix\Calendar\Core\Queue\Examples
;
4
5
use
Bitrix\Main\Loader
;
6
use
Bitrix\Main\LoaderException
;
7
use CIMNotify;
8
use Bitrix\Calendar\Core\Queue;
9
10
class
ProcessorExample
implements
Queue\Interfaces\Processor
11
{
12
16
public
function
__construct
()
17
{
18
Loader::includeModule(
'im'
);
19
}
20
24
public
function
process
(
Queue
\Interfaces\
Message
$message): string
25
{
26
$body = $message->getBody();
27
if
($userId = $body[
'userId'
])
28
{
29
CIMNotify::Add([
30
'TO_USER_ID'
=> $userId,
31
'FROM_USER_ID'
=> $userId,
32
'NOTIFY_TYPE'
=> IM_NOTIFY_SYSTEM,
33
'NOTIFY_MODULE'
=>
'calendar'
,
34
'NOTIFY_TAG'
=>
'CALENDAR|QUEUE|EXAMPLE|'
.$userId,
35
'NOTIFY_SUB_TAG'
=>
'CALENDAR|QUEUE|EXAMPLE|'
.$userId,
36
'NOTIFY_MESSAGE'
=> $body[
'content'
],
37
]);
38
return
self::ACK
;
39
}
40
else
41
{
42
return
self::REJECT
;
43
}
44
}
45
}
Bitrix\Calendar\Core\Queue\Examples\ProcessorExample
Definition
processorexample.php:11
Bitrix\Calendar\Core\Queue\Examples\ProcessorExample\__construct
__construct()
Definition
processorexample.php:16
Bitrix\Calendar\Core\Queue\Examples\ProcessorExample\process
process(Queue\Interfaces\Message $message)
Definition
processorexample.php:24
Bitrix\Main\LoaderException
Definition
loader.php:582
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Calendar\Core\Queue\Interfaces\Message
Definition
message.php:16
Bitrix\Calendar\Core\Queue\Interfaces\Processor
Definition
processor.php:5
Bitrix\Calendar\Core\Queue\Interfaces\Processor\REJECT
const REJECT
Definition
processor.php:15
Bitrix\Calendar\Core\Queue\Interfaces\Processor\ACK
const ACK
Definition
processor.php:9
Bitrix\Calendar\Core\Queue\Interfaces\Queue
Definition
queue.php:5
Bitrix\Calendar\Core\Queue\Examples
Definition
consumerclientexample.php:3
modules
calendar
lib
core
queue
examples
processorexample.php
Создано системой
1.10.0