Queue
This commit is contained in:
6
app/resources/routes/api/queue.php
Normal file
6
app/resources/routes/api/queue.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
use Incoviba\Controller\API\Queues;
|
||||
|
||||
$app->group('/queue', function($app) {
|
||||
$app->get('/run[/]', Queues::class);
|
||||
});
|
23
app/src/Controller/API/Queues.php
Normal file
23
app/src/Controller/API/Queues.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace Incoviba\Controller\API;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Service;
|
||||
|
||||
class Queues extends Ideal\Controller
|
||||
{
|
||||
use withJson;
|
||||
|
||||
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, Service\Queue $queueService): ResponseInterface
|
||||
{
|
||||
$output = [
|
||||
'success' => false
|
||||
];
|
||||
if ($queueService->run()) {
|
||||
$output['success'] = true;
|
||||
}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
}
|
17
app/src/Service/Worker/Dummy.php
Normal file
17
app/src/Service/Worker/Dummy.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace Incoviba\Service\Worker;
|
||||
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model;
|
||||
use Incoviba\Service;
|
||||
|
||||
class Dummy extends Ideal\Service implements Service\Worker
|
||||
{
|
||||
|
||||
public function execute(Model\Job $job): bool
|
||||
{
|
||||
$configuration = $job->configuration;
|
||||
$this->logger->info('Dummy worker executed', ['configuration' => $configuration]);
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user