私はZendのジョブキューAPIでcreateHttpJob
メソッドを使用しようとしますが、次のエラーを越えてくるよ:ZendのジョブキューAPI - 不明なエラー
Unable to send createHttpJob request to the Job Queue server. Unknown error.
私が使用しているコードは次のとおりです。
// Set up job queue
$queue = new \ZendJobQueue();
// Queue email to be sent
$job_id = null;
$counter = 10;
do {
try {
$job_id = $queue->createHttpJob($this->url()->fromRoute('email', array('action' => 'send-email')), array('email_id' => $email_id), array('job_timeout' => 14400, 'name' => 'Sending Email: ' . $email_id));
} catch (\Exception $e) {
usleep(100000); // 0.1 seconds
$counter--;
if($counter <= 0) {
$response = $this->getResponse();
$response->setContent(json_encode(array(
'success' => false,
'zend_queue' => true,
'exception' => $e->getMessage(),
'stack' => $e->getTraceAsString()
)));
return $response;
}
}
} while (!$job_id && $counter > 0);
このジョブは基本的にキューにジョブを追加しようとしますが、失敗した10回の試行後にエラーをフロントエンドに返します。
当然のことながら、誰もが問題を完全に解決できるとは思っていませんが、以前誰かが問題を抱えていたのか、それを防ぐために何かできることがあれば?
ありがとうございます!