php - Laravel 5 Queued Command -


i'm making app using laravel 5, @ moment i'm little problem (i hope). coded command implements shouldbequeued :

class importdatacommand extends command implements selfhandling,shouldbequeued {       use interactswithqueue, serializesmodels;      public $filepath;      /**      * create new command instance.      *      * @return void      */     public function __construct($filepath)     {         $this->filepath = $filepath;         log::info('queued shit command contructor , have destinationpath => '.$filepath);//working         echo "contructor ".$this->filepath;      }      /**      * execute command.      *      * @return void      */     public function handle()     {           $destinationpath = storage_path().'/app/gtfs/';           $zip = new ziparchive;         echo "handle ".$this->filepath;         /*$res = $zip->open($destinationpath.$this->filepath);         if ($res === true) {             $zip->extractto($destinationpath.'extracted/');             $zip->close();             echo 'done';          } else {              echo 'fail';          }*/     }  } 

and i'm calling way:

$bus->dispatch(new importdatacommand($filename)); 

my problem when command executed after being in queue(btw i'm using beanstalkd) throws exception because filepath not set, , think have understood why happening, command instantiated when sent queue on busdispatcher variable when handle() called on queue side doesn't send that. suggestions ?

you assign $this->filepath in constructor , override in handle() method.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -