Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Exchange.php
Go to the documentation of this file.
1 <?php
7 
10 use Magento\Framework\MessageQueue\ConfigInterface as MessageQueueConfig;
12 
13 class Exchange implements ExchangeInterface
14 {
18  private $messageQueueConfig;
19 
23  private $queueManagement;
24 
31  public function __construct(MessageQueueConfig $messageQueueConfig, QueueManagement $queueManagement)
32  {
33  $this->messageQueueConfig = $messageQueueConfig;
34  $this->queueManagement = $queueManagement;
35  }
36 
44  public function enqueue($topic, EnvelopeInterface $envelope)
45  {
46  $queueNames = $this->messageQueueConfig->getQueuesByTopic($topic);
47  $this->queueManagement->addMessageToQueues($topic, $envelope->getBody(), $queueNames);
48  return null;
49  }
50 }
enqueue($topic, EnvelopeInterface $envelope)
Definition: Exchange.php:44
__construct(MessageQueueConfig $messageQueueConfig, QueueManagement $queueManagement)
Definition: Exchange.php:31