37 private $queueRepository;
42 private $consumerConfig;
47 private $communicationConfig;
61 $this->queueRepository = $queueRepository;
69 return $this->getData(self::CONSUMER_NAME);
77 return $this->getData(self::MAX_MESSAGES);
85 return $this->getData(self::QUEUE_NAME);
93 $topics = $this->getData(self::TOPICS);
94 if (count($topics) > 1) {
95 throw new \LogicException(
96 'Current method is deprecated and does not support more than 1 topic declarations for consumer. ' 97 .
'Use \Magento\Framework\MessageQueue\ConsumerConfiguration::getConsumerType instead. ' 98 .
"Multiple topics declared for consumer '{$this->getConsumerName()}'" 100 }
elseif (count($topics) < 1) {
101 throw new \LogicException(
102 "There must be at least one topic declared for consumer '{$this->getConsumerName()}'." 106 $topicConfig = reset($topics);
123 $topics = $this->getData(self::TOPICS);
124 return is_array($topics) && count($topics) ? array_keys($topics) : [];
132 $connectionName = $this->getConsumerConfig()->getConsumer($this->
getConsumerName())->getConnection();
133 return $this->queueRepository->get($connectionName, $this->
getQueueName());
141 return $this->getCommunicationConfig()->getTopic($topicName)[CommunicationConfig::TOPIC_REQUEST_TYPE];
150 private function getTopicConfig($topicName)
152 if (!isset($this->getData(self::TOPICS)[$topicName])) {
153 throw new \LogicException(
"Consumer configuration for {$topicName} topic not found.");
155 return $this->getData(self::TOPICS)[$topicName];
164 private function getData($key)
166 if (!isset($this->data[$key])) {
169 return $this->data[$key];
179 private function getConsumerConfig()
181 if ($this->consumerConfig ===
null) {
184 return $this->consumerConfig;
194 private function getCommunicationConfig()
196 if ($this->communicationConfig ===
null) {
198 ->get(CommunicationConfig::class);
200 return $this->communicationConfig;
elseif(isset( $params[ 'redirect_parent']))
__construct(QueueRepository $queueRepository, MessageQueueConfig $messageQueueConfig, $data=[])
getMessageSchemaType($topicName)