doude4201 2016-11-22 14:58
浏览 9
已采纳

Zend作业队列API - 未知错误

I'm trying to use the createHttpJob method in the Zend Job Queue API, but keep coming across the following error:

Unable to send createHttpJob request to the Job Queue server. Unknown error.

The code I'm using is:

// 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);

which basically tries to add the job to the queue, and after 10 failed attempts, it will return an error back to the front-end.

Of course with it being an unknown error, I'm not expecting anyone to be able to solve the issue outright, but I was wondering if anyone had come across the issue before and if they were able to do anything to prevent it?

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • duanqilupinf67040 2016-11-29 11:21
    关注

    So I found this small piece of information here:

    Parameters sent to a job cannot exceed the size defined in the 'zend_jobqueue.max_message_size' directive which has a maximum size limit of 64KB.

    I was sending more than 64KB at times which happened to be the requests that were producing this unknown error. I don't know if that was the exact cause of the issue (if so, it would be nice to have a more descriptive error message!), but the requests all seem to be going through now with no problem.

    Hope this will help someone in the future!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题