Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ruleexample.php
1<?php
2
4
5use Bitrix;
13
14class 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}