I'm trying to change my event listeners to work with queue like so:
namespace App\Listeners;
use App\Callback;
use App\Events\TestEvent;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class TestEventListener implements ShouldQueue
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param TestEvent $event
* @return void
*/
public function handle(TestEvent $event)
{
sleep(5);
$callback = new Callback([
"full_name" => "Redis test " . date("h:m:s")
]);
$callback->save();
// echo "Here";
}
}
I've installed Redis locally for testing.
When testing this has appeared in redis-cli console:
After this first time event listener refused to work with queue. On deleting ShouldQueue interface everything works ok!
Con you please help me to find out the problem that Queue don't work?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3bDqxNQ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire