getServiceLocator()->get(RdsQueue::SERVICE_ID); /** @var QueueDispatcher $queueService */ $queueService = $this->getServiceLocator()->get(QueueDispatcherInterface::SERVICE_ID); /** @var JsonTask $queueItem */ foreach ($oldRdsQueue as $queueItem) { $label = $queueItem->getLabel(); $invokeString = $queueItem->getInvocable(); $parameters = $queueItem->getParameters(); $queueService->setOwner($queueItem->getOwner()); $queueService->createTask(new $invokeString(), $parameters, $label); $oldRdsQueue->updateTaskStatus($queueItem->getId(), Task::STATUS_ARCHIVED); $count++; } return \common_report_Report::createSuccess('Imported with success: ' . $count); } catch (\Exception $exception) { $message = $exception->getMessage(); return \common_report_Report::createFailure($message); } } }