PHP | Job Queue is Not Working when hit the function
one text
I am trying to pass an argument to the scheduler but the argument is undefined in the job queue. Please guide me on how can I solve this. Here is Code
require_once 'include/SugarQueue/SugarJobQueue.php';
$scheduledJob = new SchedulersJob();
$scheduledJob->name = "Send CRA Post";
$scheduledJob->assigned_user_id = 1;
$scheduledJob->data = json_encode($params);
$scheduledJob->target = "class::sendcrapost";
$queue = new SugarJobQueue();
$queue->submitJob($scheduledJob);
$scheduledJob->requeue = true;
$scheduledJob->retry_count = 2;
//job queue file code
<?php
$GLOBALS['log']->fatal("In Job Queue");
class sendcrapost implements RunnableSchedulerJob
{
public function run($arguments)
{
global $sugar_config, $db;
$arguments = html_entity_decode($arguments);
$arguments = json_decode($arguments);
$GLOBALS['log']->fatal("In Job Queue 2");
return true;
}
public function setJob(SchedulersJob $job)
{
$this->job = $job;
}
}
Please help to solve the problem.
Source