123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Framework\Amqp;
- /**
- * Factory class for @see \Magento\Framework\Amqp\Queue
- *
- * @api
- * @since 102.0.1
- */
- class QueueFactory implements \Magento\Framework\MessageQueue\QueueFactoryInterface
- {
- /**
- * Object Manager instance
- *
- * @var \Magento\Framework\ObjectManagerInterface
- */
- private $objectManager = null;
- /**
- * Instance name to create
- *
- * @var string
- */
- private $instanceName = null;
- /**
- * @var ConfigPool
- */
- private $configPool;
- /**
- * Initialize dependencies.
- *
- * @param \Magento\Framework\ObjectManagerInterface $objectManager
- * @param ConfigPool $configPool
- * @param string $instanceName
- */
- public function __construct(
- \Magento\Framework\ObjectManagerInterface $objectManager,
- ConfigPool $configPool,
- $instanceName = \Magento\Framework\Amqp\Queue::class
- ) {
- $this->objectManager = $objectManager;
- $this->configPool = $configPool;
- $this->instanceName = $instanceName;
- }
- /**
- * {@inheritdoc}
- * @since 102.0.1
- */
- public function create($queueName, $connectionName)
- {
- return $this->objectManager->create(
- $this->instanceName,
- [
- 'amqpConfig' => $this->configPool->get($connectionName),
- 'queueName' => $queueName
- ]
- );
- }
- }
|