Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
QueueRepository.php
Go to the documentation of this file.
1 <?php
7 
12 {
16  private $objectManager;
17 
21  private $queueInstances;
22 
26  private $queueFactory;
27 
34  public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, array $queues = [])
35  {
36  $this->objectManager = $objectManager;
37  }
38 
47  public function get($connectionName, $queueName)
48  {
49  if (!isset($this->queueInstances[$connectionName][$queueName])) {
50  $queue = $this->getQueueFactory()->create($queueName, $connectionName);
51  $this->queueInstances[$connectionName][$queueName] = $queue;
52  }
53  return $this->queueInstances[$connectionName][$queueName];
54  }
55 
62  private function getQueueFactory()
63  {
64  if ($this->queueFactory === null) {
65  $this->queueFactory = $this->objectManager->get(QueueFactoryInterface::class);
66  }
67  return $this->queueFactory;
68  }
69 }
$queue
Definition: queue.php:21
$objectManager
Definition: bootstrap.php:17
__construct(\Magento\Framework\ObjectManagerInterface $objectManager, array $queues=[])
$queues
Definition: queues.php:8