[Li Jingshan php] every day laravel-20160830| Callqueuedhandler

Source: Internet
Author: User
 container = $container;//Use this container, is container}/** * Handle the queued job. * * @param \illuminate\contracts\queue\job $job * @param array $data * @return void */Public funct    Ion call (Job $job, array $data)//Do some thing for this job, handle the queued job. {//Job $job is a interface, $data is a array, $handler = $this->setjobinstanceifnecessary (//Set Job Instance If necessary $job, $this->container->make ($data [' class]));//This handler would be is make if it NEC Essary//$job, $this->container to make $data class Call_user_func_array ([$handler, $data [' Me Thod '], unserialize ($data [' data ']);//Call_user_func_array if (! $job->isdeletedorreleased ()) {//If T        His job need is released or deleted $job->delete ();     }}/** * Set The job instance of the given class if necessary. * * @param \illuminate\contracts\queue\job $job * @param mixed $instance * @return Mixed */protected function setjobinstanceifnecessary (Job $ Job, $instance) {if (In_array (' Illuminate\queue\interactswithqueue ', class_uses_recursive (Get_class ($instance))        ) {$instance->setjob ($job);        }//if in the necessary array data, we'll set this job. return $instance;    Return this instance}//set the job being instance of the given class, if necessary.!     /** * The failed method on the job instance. * * @param array $data * @return void */Public Function failed (array $data) {$handler = $this ->container->make ($data [' class ']),//Make handler if (Method_exists ($handler, ' failed ')) {//if have this Func        tion, to use it Call_user_func_array ([$handler, ' failed '), unserialize ($data [' data ']); }}//call the failed method on the job instance.}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.