I am trying to run a background job in a controller but wondering if its actually possible. I'm not sure about namespacing and could do with some guidance on whether the job should be running in the plugins service or not. I get errors like: Class 'modules\importGeoJson\BaseJob' not found. I cant really tell from docs or find a clear example on this.
namespace
namespace\pluginname\controllers;
use Craft;
use craft\web\Controller;
use craft\web\View;
use craft\elements\Entry;
use craft\db\Query;
use craft\base\Element;
use craft\db\QueryAbortedException;
use craft\helpers\App;
class DefaultController extends Controller{
//etc
public function StartJob{
\craft\helpers\Queue::push(new importGeoJson(), 10);
}
}
namespace modules\jobs;
class importGeoJson extends BaseJob
{
public function execute($queue)
{
}
}