ZEND job queue api returning empty results

453 views Asked by At
$jobs = $jq->getJobsList(array(
'status' => ZendJobQueue::STATUS_RUNNING
);

The above code is returning empty result though there are multiple process running(i can see it using zend server User Interface). List of status starting from int 0

const int STATUS_PENDING;
const int STATUS_WAITING_PREDECESSOR;
const int STATUS_RUNNING;
const int STATUS_COMPLETED;
const int STATUS_FAILED;
const int STATUS_OK;
const int STATUS_LOGICALLY_FAILED;
const int STATUS_TIMEOUT;
const int STATUS_REMOVED;
const int STATUS_SCHEDULED;
const int STATUS_SUSPENDED

; But when i run a process and immediately if i check

$jobs = $jq->getJobsList(array(
    'status' => ZendJobQueue::STATUS_FAILED
    );

That is giving wrong result again

Array
(
    [0] => Array
        (
            [id] => 266
            [type] => 1
            [node_id] => 0
            [queue_name] => 
            [status] => 2//look this status it is for running process as of documentation
            [priority] => 1
            [persistent] => 
            [script] => http://localhost:3030/feecalc/index.php?job=runFeecalc
            [predecessor] => 0
            [name] => 1
            [vars] => {"session_code":"20124 ","user_id":"70"}
            [http_headers] => 
            [output] => 
            [error] => 
            [start_time] => 2013-09-06 12:37:31
            [creation_time] => 2013-09-06 12:37:31
            [end_time] => 
            [schedule] => 
            [schedule_time] => 
            [schedule_id] => 0
            [app_id] => -1
        )

)

I am using zend enterprise version 6(trial)

Does anyone has a solution ?

1

There are 1 answers

0
Arun Killu On BEST ANSWER

I have contacted the Zend personnel so I will paste the response as answer.

Indeed the documentation isn't too clear about this, but you need to use the class constant starting with the 'JOB_STATUS_' prefix, so in your case, do as follows:

$jobs = $jq->getJobsList(array(
'status' => ZendJobQueue::JOB_STATUS_RUNNING
);