From 6f64fbcb780410fe08aa9f02d55c1476323e7975 Mon Sep 17 00:00:00 2001 From: Illia Grybkov Date: Sat, 27 Oct 2018 02:29:04 +0300 Subject: [PATCH 1/2] Change default transport to 'null' which does not require any dependencies after install --- Model/Config/Source/Transport.php | 1 + Model/EnqueueManager.php | 11 +++++++++++ etc/config.xml | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Model/Config/Source/Transport.php b/Model/Config/Source/Transport.php index cf02261..4a08a46 100644 --- a/Model/Config/Source/Transport.php +++ b/Model/Config/Source/Transport.php @@ -20,6 +20,7 @@ public function toOptionArray() ['value' => 'sqs', 'label' => __('Amazon AWS SQS')], ['value' => 'redis', 'label' => __('Redis')], ['value' => 'dbal', 'label' => __('Doctrine DBAL')], + ['value' => 'null', 'label' => __('Null transport')], ]; } } diff --git a/Model/EnqueueManager.php b/Model/EnqueueManager.php index 6455e35..74f1653 100644 --- a/Model/EnqueueManager.php +++ b/Model/EnqueueManager.php @@ -141,6 +141,9 @@ public function buildConfig() case 'dbal': $config['transport'] = $this->getDbalConfig(); break; + case 'null': + $config['transport'] = $this->getNullConfig(); + break; default: throw new \LogicException(sprintf('Unknown transport: "%s"', $name)); } @@ -281,4 +284,12 @@ public function getDbalConfig() 'lazy' => (bool) $this->scopeConfig->getValue('enqueue/dbal/lazy'), ]]; } + + /** + * @return array + */ + private function getNullConfig(): array + { + return ['null' => []]; + } } \ No newline at end of file diff --git a/etc/config.xml b/etc/config.xml index 0083b75..1799c9d 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -4,7 +4,7 @@ - rabbitmq_amqp + null enqueue From b7d19390efb7c2195ce81043144d556e9ff15b90 Mon Sep 17 00:00:00 2001 From: Illia Grybkov Date: Sat, 27 Oct 2018 03:50:05 +0300 Subject: [PATCH 2/2] Add Null transport to plugin which validates configuration --- Plugin/Model/Config/ConfigPlugin.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Plugin/Model/Config/ConfigPlugin.php b/Plugin/Model/Config/ConfigPlugin.php index 826874f..c8e798a 100644 --- a/Plugin/Model/Config/ConfigPlugin.php +++ b/Plugin/Model/Config/ConfigPlugin.php @@ -3,6 +3,7 @@ namespace Enqueue\Magento2\Plugin\Model\Config; use \Enqueue\AmqpExt\AmqpContext; +use Enqueue\Null\NullContext; use \Enqueue\Stomp\StompContext; use \Enqueue\Fs\FsContext; use \Enqueue\Sqs\SqsContext; @@ -55,6 +56,11 @@ class ConfigPlugin 'name' => 'Doctrine DBAL', 'package' => 'enqueue/dbal', 'class' => DbalContext::class, + ], + 'null' => [ + 'name' => 'Null transport', + 'package' => 'enqueue/null', + 'class' => NullContext::class ] ];