Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
ruleexample.php
1
<?php
2
3
namespace
Bitrix\Calendar\Core\Queue\Examples
;
4
5
use
Bitrix
;
6
use
Bitrix\Calendar\Core\Queue\Interfaces
;
7
use
Bitrix\Calendar\Core\Queue\Interfaces\Message
;
8
use
Bitrix\Calendar\Core\Queue\Message\Dictionary
;
9
use
Bitrix\Calendar\Core\Queue\Queue\Queue
;
10
use
Bitrix\Calendar\Core\Queue\Queue\QueueFactory
;
11
use
Bitrix\Calendar\Core\Queue\Queue\QueueRegistry
;
12
use
Bitrix\Calendar\Core\Queue\Rule\Rules\DbRule
;
13
14
class
RuleExample
extends
DbRule
implements
Interfaces\RouteRule
15
{
21
protected
function
getTargetQueue
(
Message
$message): ?
Queue
22
{
23
$routingKey = $message->
getHeaders
()[
Dictionary::HEADER_KEYS
[
'routingKey'
]] ??
null
;
24
if
($routingKey ===
'example'
)
25
{
26
$queue = (
new
QueueFactory
())->getById(QueueRegistry::QUEUE_LIST[
'Example'
]);
27
return
$queue;
28
}
29
30
return
null
;
31
}
32
38
protected
function
getMessageHash
(
Message
$message): string
39
{
40
return
'ExamplePrefix_'
. $message->
getBody
()[
'exampleField'
];
41
}
42
}
Bitrix\Calendar\Core\Queue\Examples\RuleExample
Definition
ruleexample.php:15
Bitrix\Calendar\Core\Queue\Examples\RuleExample\getTargetQueue
getTargetQueue(Message $message)
Definition
ruleexample.php:21
Bitrix\Calendar\Core\Queue\Examples\RuleExample\getMessageHash
getMessageHash(Message $message)
Definition
ruleexample.php:38
Bitrix\Calendar\Core\Queue\Message\Dictionary
Definition
dictionary.php:6
Bitrix\Calendar\Core\Queue\Message\Dictionary\HEADER_KEYS
const HEADER_KEYS
Definition
dictionary.php:13
Bitrix\Calendar\Core\Queue\Queue\QueueFactory
Definition
queuefactory.php:6
Bitrix\Calendar\Core\Queue\Queue\QueueRegistry
Definition
queueregistry.php:7
Bitrix\Calendar\Core\Queue\Rule\Rules\DbRule
Definition
dbrule.php:12
Bitrix\Calendar\Core\Queue\Interfaces\Message
Definition
message.php:16
Bitrix\Calendar\Core\Queue\Interfaces\Message\getHeaders
getHeaders()
Bitrix\Calendar\Core\Queue\Interfaces\Message\getBody
getBody()
Bitrix\Calendar\Core\Queue\Interfaces\Queue
Definition
queue.php:5
Bitrix\Calendar\Core\Queue\Interfaces\RouteRule
Definition
routerule.php:8
Bitrix\Calendar\Core\Queue\Examples
Definition
consumerclientexample.php:3
Bitrix\Calendar\Core\Queue\Interfaces
Definition
consumer.php:3
Bitrix
modules
calendar
lib
core
queue
examples
ruleexample.php
Создано системой
1.10.0