From b49661b8bec989a2b8dda4360da027b2ad0e2a3c Mon Sep 17 00:00:00 2001 From: Jonathan Martz Date: Tue, 2 Oct 2018 11:36:14 +0200 Subject: [PATCH 1/4] add option run-once to ce_mq:consumers:start --- Console/StartConsumerCommand.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Console/StartConsumerCommand.php b/Console/StartConsumerCommand.php index 29b0e6b..af152a3 100644 --- a/Console/StartConsumerCommand.php +++ b/Console/StartConsumerCommand.php @@ -19,6 +19,7 @@ class StartConsumerCommand extends Command const OPTION_POLL_INTERVAL = 'interval'; const OPTION_MESSAGE_LIMIT = 'limit'; const OPTION_MESSAGE_REQUEUE = 'requeue'; + const OPTION_MESSAGE_RUN_ONCE = 'run-once'; /** * @var QueueConfig @@ -70,6 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $interval = $input->getOption(self::OPTION_POLL_INTERVAL); $limit = $input->getOption(self::OPTION_MESSAGE_LIMIT); $requeue = (bool)$input->getOption(self::OPTION_MESSAGE_REQUEUE); + $runOnce = (bool)$input->getOption(self::OPTION_MESSAGE_RUN_ONCE); // Prepare consumer and broker $broker = $this->queueConfig->getQueueBrokerInstance($queueName); @@ -78,12 +80,18 @@ protected function execute(InputInterface $input, OutputInterface $output) do { $limit--; $message = $broker->peek(); - + if (!$message) { usleep($interval * 1000); - continue; + + if($runOnce){ + break; + } + else{ + continue; + } } - + try { $consumer->process( $this->messageEncoder->decode($queueName, $message->getContent()) @@ -130,7 +138,13 @@ protected function configure() 'Requeue messages on failure (1 to enable, 0 to disable).', 0 ); + $this->addOption( + self::OPTION_MESSAGE_RUN_ONCE, + null, + InputOption::VALUE_NONE, + 'Requeue messages on failure (1 to enable, 0 to disable).' + ); parent::configure(); } -} +} \ No newline at end of file From 8864c468cbfb3728aa38b29b206303cdbc49011c Mon Sep 17 00:00:00 2001 From: Jonathan Martz Date: Tue, 2 Oct 2018 11:52:36 +0200 Subject: [PATCH 2/4] remove unnecessary else --- Console/StartConsumerCommand.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Console/StartConsumerCommand.php b/Console/StartConsumerCommand.php index af152a3..841c8b6 100644 --- a/Console/StartConsumerCommand.php +++ b/Console/StartConsumerCommand.php @@ -87,9 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if($runOnce){ break; } - else{ - continue; - } + continue; } try { @@ -147,4 +145,4 @@ protected function configure() parent::configure(); } -} \ No newline at end of file +} From fedaed1ec07c6a3714c1bfc24f9cb36ef5fd3b31 Mon Sep 17 00:00:00 2001 From: Jonathan Martz Date: Tue, 2 Oct 2018 14:59:30 +0200 Subject: [PATCH 3/4] update option description --- Console/StartConsumerCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Console/StartConsumerCommand.php b/Console/StartConsumerCommand.php index 841c8b6..dc90982 100644 --- a/Console/StartConsumerCommand.php +++ b/Console/StartConsumerCommand.php @@ -140,7 +140,7 @@ protected function configure() self::OPTION_MESSAGE_RUN_ONCE, null, InputOption::VALUE_NONE, - 'Requeue messages on failure (1 to enable, 0 to disable).' + 'Stop Process when queue is empty' ); parent::configure(); From 3ba8f4611ce176f2e986d3b08c5fb0d55bfbb95d Mon Sep 17 00:00:00 2001 From: Jonathan Martz Date: Fri, 22 Nov 2019 11:22:37 +0100 Subject: [PATCH 4/4] [VOSSCHEM-276] composer add support for php 7.3 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9d4c6a3..7d364dc 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ } ], "require": { - "php": "~7.1.0|~7.2.0", + "php": "~7.1.0|~7.2.0|~7.3.0", "symfony/console": "~4.1.9", "magento/framework": "102.0.*", "magento/module-store": "101.0.*"