diff --git a/CHANGELOG.md b/CHANGELOG.md index 1245c1d07..5908b10e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning. +### 7.6.0 +* Deprecate MySQL as message queue provider, the extension now uses RabbitMQ as the default message queue provider +* Add command to clear the Nosto message queue +* Move Nosto logfiles to its own files nosto-debug.log(debug), nosto-system.log(info) and nosto-exception.log(error) + ### 7.5.1 * Upgrade SDK to 7.4 * Remove PII information from Order Export diff --git a/Console/Command/NostoClearQueueCommand.php b/Console/Command/NostoClearQueueCommand.php new file mode 100644 index 000000000..87febbca3 --- /dev/null +++ b/Console/Command/NostoClearQueueCommand.php @@ -0,0 +1,110 @@ +consumerConfig = $consumerConfig; + $this->queueRepository = $queueRepository; + parent::__construct(); + } + + /** + * Configure the command and the arguments + */ + protected function configure() + { + $this->setName('nosto:clear:message-queue') + ->setDescription('Clear all message queues for Nosto product sync topics.'); + parent::configure(); + } + + /** + * @inheritDoc + */ + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + + try { + foreach ($this->consumers as $queueName) { + $this->clearQueue($io, $queueName); + } + $io->success('Successfully cleared message queues.'); + } catch (RuntimeException|LocalizedException $e) { + $io->error('An error occurred while clearing message queues: ' . $e->getMessage()); + return 1; + } + return 0; + } + + /** + * Clear message queues by consumer name. + * + * @param SymfonyStyle $io + * @param string $consumerName + * @return void + * @throws LocalizedException + */ + private function clearQueue(SymfonyStyle $io, string $consumerName): void + { + $io->writeln(sprintf('Clearing messages from %s', $consumerName)); + $io->createProgressBar(); + $io->progressStart(); + $consumerConfig = $this->consumerConfig->getConsumer($consumerName); + $queue = $this->queueRepository->get($consumerConfig->getConnection(), $consumerConfig->getQueue()); + while ($message = $queue->dequeue()) { + $io->progressAdvance(1); + $queue->acknowledge($message); + } + $io->progressFinish(); + } +} diff --git a/Logger/DebugHandler.php b/Logger/DebugHandler.php new file mode 100644 index 000000000..64d9568b8 --- /dev/null +++ b/Logger/DebugHandler.php @@ -0,0 +1,46 @@ + + * @copyright 2020 Nosto Solutions Ltd + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause + * + */ + +namespace Nosto\Tagging\Logger; + +use Magento\Framework\Logger\Handler\Base; +use Monolog\Logger; + +class DebugHandler extends Base +{ + protected $fileName = '/var/log/nosto-debug.log'; + protected $loggerType = Logger::DEBUG; +} diff --git a/Logger/ExceptionHandler.php b/Logger/ExceptionHandler.php new file mode 100644 index 000000000..267facc47 --- /dev/null +++ b/Logger/ExceptionHandler.php @@ -0,0 +1,46 @@ + + * @copyright 2020 Nosto Solutions Ltd + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause + * + */ + +namespace Nosto\Tagging\Logger; + +use Magento\Framework\Logger\Handler\Base; +use Monolog\Logger; + +class ExceptionHandler extends Base +{ + protected $fileName = '/var/log/nosto-exception.log'; + protected $loggerType = Logger::INFO; +} diff --git a/Logger/SystemHandler.php b/Logger/SystemHandler.php new file mode 100644 index 000000000..2c3e961b6 --- /dev/null +++ b/Logger/SystemHandler.php @@ -0,0 +1,46 @@ + + * @copyright 2020 Nosto Solutions Ltd + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause + * + */ + +namespace Nosto\Tagging\Logger; + +use Magento\Framework\Logger\Handler\Base; +use Monolog\Logger; + +class SystemHandler extends Base +{ + protected $fileName = '/var/log/nosto-system.log'; + protected $loggerType = Logger::INFO; +} diff --git a/composer.json b/composer.json index 1adf6dbfc..4a128c076 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "nosto/module-nostotagging", "description": "Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.", "type": "magento2-module", - "version": "7.5.1", + "version": "7.6.0", "require-dev": { "phpmd/phpmd": "^2.5", "sebastian/phpcpd": "*", diff --git a/composer.lock b/composer.lock index 3510127d3..db586637f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9dcdb02accf946756f26a0c83c6deb7a", + "content-hash": "c08b01fdc7786f36fb6b4536c44379ea", "packages": [ { "name": "brick/math", @@ -284,16 +284,16 @@ }, { "name": "composer/composer", - "version": "2.2.23", + "version": "2.2.24", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "d1542e89636abf422fde328cb28d53752efb69e5" + "reference": "91d9d38ebc274267f952ee1fd3892dc7962075f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/d1542e89636abf422fde328cb28d53752efb69e5", - "reference": "d1542e89636abf422fde328cb28d53752efb69e5", + "url": "https://api.github.com/repos/composer/composer/zipball/91d9d38ebc274267f952ee1fd3892dc7962075f4", + "reference": "91d9d38ebc274267f952ee1fd3892dc7962075f4", "shasum": "" }, "require": { @@ -363,7 +363,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.2.23" + "source": "https://github.com/composer/composer/tree/2.2.24" }, "funding": [ { @@ -379,7 +379,7 @@ "type": "tidelift" } ], - "time": "2024-02-08T14:08:53+00:00" + "time": "2024-06-10T20:51:52+00:00" }, { "name": "composer/metadata-minifier", @@ -1128,12 +1128,12 @@ "version": "v5.2.13", "source": { "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", + "url": "https://github.com/jsonrainbow/json-schema.git", "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/fbbe7e5d79f618997bc3332a6f49246036c45793", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/fbbe7e5d79f618997bc3332a6f49246036c45793", "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793", "shasum": "" }, @@ -1188,8 +1188,8 @@ "schema" ], "support": { - "issues": "https://github.com/justinrainbow/json-schema/issues", - "source": "https://github.com/justinrainbow/json-schema/tree/v5.2.13" + "issues": "https://github.com/jsonrainbow/json-schema/issues", + "source": "https://github.com/jsonrainbow/json-schema/tree/v5.2.13" }, "time": "2023-09-26T02:20:38+00:00" }, @@ -4702,16 +4702,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.38", + "version": "v5.4.40", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "899330a01056077271e2f614c7b28b0379a671eb" + "reference": "26dd9912df6940810ea00f8f53ad48d6a3424995" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/899330a01056077271e2f614c7b28b0379a671eb", - "reference": "899330a01056077271e2f614c7b28b0379a671eb", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/26dd9912df6940810ea00f8f53ad48d6a3424995", + "reference": "26dd9912df6940810ea00f8f53ad48d6a3424995", "shasum": "" }, "require": { @@ -4720,6 +4720,9 @@ "symfony/polyfill-mbstring": "~1.8", "symfony/polyfill-php80": "^1.16" }, + "require-dev": { + "symfony/process": "^5.4|^6.4" + }, "type": "library", "autoload": { "psr-4": { @@ -4746,7 +4749,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.38" + "source": "https://github.com/symfony/filesystem/tree/v5.4.40" }, "funding": [ { @@ -4762,20 +4765,20 @@ "type": "tidelift" } ], - "time": "2024-03-21T08:05:07+00:00" + "time": "2024-05-31T14:33:22+00:00" }, { "name": "symfony/finder", - "version": "v5.4.35", + "version": "v5.4.40", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "abe6d6f77d9465fed3cd2d029b29d03b56b56435" + "reference": "f51cff4687547641c7d8180d74932ab40b2205ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/abe6d6f77d9465fed3cd2d029b29d03b56b56435", - "reference": "abe6d6f77d9465fed3cd2d029b29d03b56b56435", + "url": "https://api.github.com/repos/symfony/finder/zipball/f51cff4687547641c7d8180d74932ab40b2205ce", + "reference": "f51cff4687547641c7d8180d74932ab40b2205ce", "shasum": "" }, "require": { @@ -4809,7 +4812,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.35" + "source": "https://github.com/symfony/finder/tree/v5.4.40" }, "funding": [ { @@ -4825,7 +4828,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-05-31T14:33:22+00:00" }, { "name": "symfony/http-client-contracts", @@ -12392,5 +12395,5 @@ "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.6.0" } diff --git a/etc/di.xml b/etc/di.xml index 3f85137fd..cccf6dccd 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -76,8 +76,9 @@ nosto - Magento\Framework\Logger\Handler\System - Magento\Framework\Logger\Handler\Debug + Nosto\Tagging\Logger\SystemHandler + Nosto\Tagging\Logger\DebugHandler + Nosto\Tagging\Logger\ExceptionHandler @@ -98,6 +99,9 @@ Nosto\Tagging\Console\Command\NostoGenerateCustomerReferenceCommand + + Nosto\Tagging\Console\Command\NostoClearQueueCommand + @@ -234,4 +238,4 @@ 500 - + \ No newline at end of file diff --git a/etc/module.xml b/etc/module.xml index 933a24fbf..d7070be90 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -37,5 +37,5 @@ - + diff --git a/etc/queue.xml b/etc/queue.xml index 95666bc8a..f8ad78b09 100644 --- a/etc/queue.xml +++ b/etc/queue.xml @@ -35,13 +35,13 @@ --> - + - + diff --git a/etc/queue_publisher.xml b/etc/queue_publisher.xml index 0d044bc71..1194a0372 100644 --- a/etc/queue_publisher.xml +++ b/etc/queue_publisher.xml @@ -36,9 +36,9 @@ - + - + diff --git a/etc/queue_topology.xml b/etc/queue_topology.xml index 8f70a8190..2b929aa7b 100644 --- a/etc/queue_topology.xml +++ b/etc/queue_topology.xml @@ -35,7 +35,7 @@ --> - +