diff --git a/src/Service/ScheduledTask/DailyProductSyncScheduledTaskHandler.php b/src/Service/ScheduledTask/DailyProductSyncScheduledTaskHandler.php index b514d82d..591a0979 100644 --- a/src/Service/ScheduledTask/DailyProductSyncScheduledTaskHandler.php +++ b/src/Service/ScheduledTask/DailyProductSyncScheduledTaskHandler.php @@ -16,11 +16,12 @@ use Shopware\Core\Framework\Api\Context\SystemSource; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; -use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTask; use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler; use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Messenger\Attribute\AsMessageHandler; +#[AsMessageHandler(handles: DailyProductSyncScheduledTask::class)] class DailyProductSyncScheduledTaskHandler extends ScheduledTaskHandler { private const LAST_EXECUTION_TIME_CONFIG = 'dailySyncLastTime'; @@ -36,14 +37,6 @@ public function __construct( parent::__construct($scheduledTaskRepository); } - /** - * @return ScheduledTask[] - */ - public static function getHandledMessages(): iterable - { - return [DailyProductSyncScheduledTask::class]; - } - public function run(): void { if ($this->isTimeToRunJob()) { diff --git a/src/Service/ScheduledTask/EntityChangelogScheduledTaskHandler.php b/src/Service/ScheduledTask/EntityChangelogScheduledTaskHandler.php index f98a6ea5..b7f0a898 100644 --- a/src/Service/ScheduledTask/EntityChangelogScheduledTaskHandler.php +++ b/src/Service/ScheduledTask/EntityChangelogScheduledTaskHandler.php @@ -8,10 +8,11 @@ use Nosto\Scheduler\Model\Job\GeneratingHandlerInterface; use Nosto\Scheduler\Model\JobScheduler; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; -use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTask; use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler; use Shopware\Core\Framework\Uuid\Uuid; +use Symfony\Component\Messenger\Attribute\AsMessageHandler; +#[AsMessageHandler(handles: EntityChangelogScheduledTask::class)] class EntityChangelogScheduledTaskHandler extends ScheduledTaskHandler implements GeneratingHandlerInterface { public function __construct( @@ -21,14 +22,6 @@ public function __construct( parent::__construct($scheduledTaskRepository); } - /** - * @return ScheduledTask[] - */ - public static function getHandledMessages(): iterable - { - return [EntityChangelogScheduledTask::class]; - } - public function run(): void { $jobMessage = new EntityChangelogSyncMessage(Uuid::randomHex()); diff --git a/src/Service/ScheduledTask/OldJobCleanupScheduledTaskHandler.php b/src/Service/ScheduledTask/OldJobCleanupScheduledTaskHandler.php index 4cbceb0c..df1d66ff 100644 --- a/src/Service/ScheduledTask/OldJobCleanupScheduledTaskHandler.php +++ b/src/Service/ScheduledTask/OldJobCleanupScheduledTaskHandler.php @@ -16,10 +16,11 @@ use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\ContainsFilter; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\RangeFilter; -use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTask; use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler; +use Symfony\Component\Messenger\Attribute\AsMessageHandler; use Throwable; +#[AsMessageHandler(handles: OldJobCleanupScheduledTask::class)] class OldJobCleanupScheduledTaskHandler extends ScheduledTaskHandler { public function __construct( @@ -31,14 +32,6 @@ public function __construct( parent::__construct($scheduledTaskRepository); } - /** - * @return ScheduledTask[] - */ - public static function getHandledMessages(): iterable - { - return [OldJobCleanupScheduledTask::class]; - } - public function run(): void { try { diff --git a/src/Service/ScheduledTask/OldNostoDataCleanupScheduledTaskHandler.php b/src/Service/ScheduledTask/OldNostoDataCleanupScheduledTaskHandler.php index c748351a..7f022203 100644 --- a/src/Service/ScheduledTask/OldNostoDataCleanupScheduledTaskHandler.php +++ b/src/Service/ScheduledTask/OldNostoDataCleanupScheduledTaskHandler.php @@ -10,10 +10,11 @@ use Psr\Log\LoggerInterface; use Shopware\Core\Defaults; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; -use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTask; use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler; +use Symfony\Component\Messenger\Attribute\AsMessageHandler; use Throwable; +#[AsMessageHandler(handles: OldNostoDataCleanupScheduledTask::class)] class OldNostoDataCleanupScheduledTaskHandler extends ScheduledTaskHandler { public function __construct( @@ -25,14 +26,6 @@ public function __construct( parent::__construct($scheduledTaskRepository); } - /** - * @return ScheduledTask[] - */ - public static function getHandledMessages(): iterable - { - return [OldNostoDataCleanupScheduledTask::class]; - } - public function run(): void { try {