Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/7.6.0 #856

Merged
merged 25 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7e03d70
Add new command for emptying queus in RabbitMq and MySql
ugljesaspx May 30, 2024
26ee8cc
Clear code
ugljesaspx May 30, 2024
f733ad9
Formatting
ugljesaspx May 30, 2024
a9f269a
Formatting Code
ugljesaspx May 30, 2024
af54526
Formatting Code
ugljesaspx May 30, 2024
378dc83
Formatting Code
ugljesaspx May 31, 2024
da798c1
Drop MySQL support for message queueing
supercid Jun 4, 2024
4806432
Rename default exchange name to magento-amqp
supercid Jun 4, 2024
d2f8f9a
Tidying code, clearing only rabbitmq queues
ugljesaspx Jun 5, 2024
570a839
Remove unused variable
ugljesaspx Jun 5, 2024
c7b7e56
Merge pull request #854 from Nosto/feature/deprecate-message-queue-mysql
supercid Jun 5, 2024
f23fdcf
Fixing for CI
ugljesaspx Jun 5, 2024
f7c2eca
Use Magento\Framework\MessageQueue to clear message queues
supercid Jun 6, 2024
43bc665
Merge remote-tracking branch 'origin/develop' into spx_ssp_55
supercid Jun 6, 2024
c5276ed
Merge pull request #853 from Nosto/spx_ssp_55
supercid Jun 7, 2024
dda0870
Bump composer/composer from 2.2.23 to 2.2.24
dependabot[bot] Jun 10, 2024
a60a9b7
Bump version && update changelog
supercid Jun 11, 2024
30d73d9
Merge pull request #855 from Nosto/dependabot/composer/composer/compo…
supercid Jun 13, 2024
d61ede8
Merge remote-tracking branch 'origin/develop' into release/7.6.0
supercid Jun 13, 2024
2dbed62
di.xml remove unused param
supercid Jun 13, 2024
311abd4
Move logs to own Nosto files
supercid Jun 13, 2024
60a4c44
Merge pull request #857 from Nosto/feature/logging
supercid Jun 13, 2024
6f0dbf2
Merge remote-tracking branch 'origin/develop' into release/7.6.0
supercid Jun 13, 2024
9a01f93
Log exceptions to nosto-exception.log file
supercid Jun 13, 2024
1857550
Update changelog
supercid Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
110 changes: 110 additions & 0 deletions Console/Command/NostoClearQueueCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php

namespace Nosto\Tagging\Console\Command;

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\MessageQueue\Consumer\ConfigInterface as ConsumerConfig;
use Magento\Framework\MessageQueue\QueueRepository;
use RuntimeException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class NostoClearQueueCommand extends Command
{
/**
* Nosto Product Sync Update label.
*
* @var string
*/
public const NOSTO_UPDATE_SYNC_MESSAGE_QUEUE = 'nosto_product_sync.update';

/**
* Nosto Product Sync Delete label.
*
* @var string
*/
public const NOSTO_DELETE_MESSAGE_QUEUE = 'nosto_product_sync.delete';

/**
* @var ConsumerConfig
*/
private $consumerConfig;

/**
* @var QueueRepository
*/
private $queueRepository;

private array $consumers = [
self::NOSTO_DELETE_MESSAGE_QUEUE,
self::NOSTO_UPDATE_SYNC_MESSAGE_QUEUE,
];

/**
* NostoClearQueueCommand constructor.
*
* @param ConsumerConfig $consumerConfig
* @param QueueRepository $queueRepository
*/
public function __construct(
ConsumerConfig $consumerConfig,
QueueRepository $queueRepository
) {
$this->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();
}
}
46 changes: 46 additions & 0 deletions Logger/DebugHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* Copyright (c) 2020, Nosto Solutions Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Nosto Solutions Ltd <[email protected]>
* @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;
}
46 changes: 46 additions & 0 deletions Logger/ExceptionHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* Copyright (c) 2020, Nosto Solutions Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Nosto Solutions Ltd <[email protected]>
* @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;
}
46 changes: 46 additions & 0 deletions Logger/SystemHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* Copyright (c) 2020, Nosto Solutions Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Nosto Solutions Ltd <[email protected]>
* @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;
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
Loading
Loading