I'm trying to change default queue to another queue of broadcasting event but not work.
I'm tried following instruction from here. Add public $broadcastQueue = 'exports';
but its still running on default queue.
I'm using laravel 5.8. Here is my code.
My controller:
$paramRequest = $request->input();
dispatch(new ProcessExportExcel($paramRequest))->onQueue('exports');
return response()->json('job dispatched to default queue');
My job:
class ProcessExportExcel implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $request;
public $tries = 3;
public function __construct($request)
{
$this->request = $request;
}
public function handle()
{
$condition = $this->request;
// export excel process...
event(new ExportNotificationEvent($responeData));
}
}
My event:
class ExportNotificationEvent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $data;
public $broadcastQueue = 'exports';
public function broadcastQueue()
{
return 'exports';
}
public function __construct($data)
{
$this->data = $data;
}
public function broadcastOn()
{
return new Channel('excel-channel.' . $this->data['userId']);
}
public function broadcastAs()
{
return 'excel-event';
}
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ZlNYV0
via IFTTT
Aucun commentaire:
Enregistrer un commentaire