php - Laravel. Common queue for two projects -


i have 2 different projects. laravel project , laravel project b. , need create task project project b through queue. , dont want create job in project a.

currently realisation is:

project a

job state without business logic:

<?php  namespace app\jobs;  use ...;  /**  * fake class!!!  */ class myjob extends job implements shouldqueue {     use interactswithqueue, serializesmodels;      public $queue = 'myqueue';      /**      * state      */     protected $_contentid;      public function __construct($contentid)     {         $this->_contentid = $contentid;     }      /**      * excess. dont need business logic in project a.      */     public function handle()     {     } } 

and push job queue in project a:

    ...     $this->dispatch(         new myjob($this->_contentid)     );     ... 

project b

<?php  namespace app\jobs;  use ...;  /**  * needed class  */ class myjob extends job implements shouldqueue {     use interactswithqueue, serializesmodels;      public $queue = 'myqueue';      /**      * state      */     protected $_contentid;      public function __construct($contentid)     {         $this->_contentid = $contentid;     }      /**      * here business logic. in project b!      */     public function handle()     {         artisan::call('my_command', [             'id' => $this->_contentid,         ]);     } } 

so, how without myjob in project a?

laravel expects both ends (dispatcher , listener) run same application - serializations , deserializations work correctly.

out of box, laravel (or lumen) doesn't support plain queue messages receiving end may run different application or framework.

if use sqs queues, custom sqs connector can you. otherwise, have write 1 yourself.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo