A step in the right direction seems to be to change the Queue line to Queue::push('App\Jobs\CheckTopic', ['url' => $url]);.
But then how can I access the url data from in the job?
I have opted to use the database queue driver for now. I have a job in app/Jobs/, then in a Controller I have the relavent use statement. Then when I have the line Queue::push(new CheckTopic($url)); I get the following error: “Exception in Queue.php line 91: Serialization of 'Closure' is not allowed”. Here’s the stack trace:
in Queue.php line 91
at serialize(object(CheckTopic)) in Queue.php line 91
at Queue->createPayload(object(CheckTopic), '') in DatabaseQueue.php line 67
at DatabaseQueue->push(object(CheckTopic))
at call_user_func_array(array(object(DatabaseQueue), 'push'), array(object(CheckTopic))) in QueueManager.php line 223
at QueueManager->__call('push', array(object(CheckTopic))) in Facade.php line 210
at QueueManager->push(object(CheckTopic)) in Facade.php line 210
at Facade::__callStatic('push', array(object(CheckTopic))) in TopicsController.php line 44
at Queue::push(object(CheckTopic)) in TopicsController.php line 44
at TopicsController->update(object(Request)) in HTTPPostController.php line 23
at HTTPPostController->checkMode(object(Request))
at call_user_func_array(array(object(HTTPPostController), 'checkMode'), array(object(Request))) in Container.php line 523
at Container->call(array(object(HTTPPostController), 'checkMode'), array()) in Application.php line 1296
at Application->callControllerCallable(array(object(HTTPPostController), 'checkMode'), array()) in Application.php line 1261
at Application->callLumenController(object(HTTPPostController), 'checkMode', array(true, array('uses' => 'App\Http\Controllers\HTTPPostController@checkMode'), array())) in Application.php line 1232
at Application->callControllerAction(array(true, array('uses' => 'App\Http\Controllers\HTTPPostController@checkMode'), array())) in Application.php line 1200
at Application->callActionOnArrayBasedRoute(array(true, array('uses' => 'App\Http\Controllers\HTTPPostController@checkMode'), array())) in Application.php line 1185
at Application->handleArrayBasedFoundRoute(array(true, array('uses' => 'App\Http\Controllers\HTTPPostController@checkMode'), array())) in Application.php line 1163
at Application->handleFoundRoute(array(true, array('uses' => 'App\Http\Controllers\HTTPPostController@checkMode'), array())) in Application.php line 1090
at Application->dispatch(null) in Application.php line 1035
at Application->run() in index.php line 28
Anyone any idea how to fix this?
Just to make sure, I have installed jeremeamia/superclosure and still get the same error.
OK, fixed this, I was instantiating a Guzzle client in the __construct() method, which was causing the serialization issues.
Please or to participate in this conversation.