vendredi 29 avril 2016

How to Queued Event Listeners to Amazon SQS in Laravel

I follow the Laravel Document ( http://ift.tt/1WuxqUX ) to create an event listener and implement the \Illuminate\Contracts\Queue\ShouldQueue contract:

use App\Events\SomeEvent;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class EventListener implements ShouldQueue
{
    public function __construct()
    {
        //
    }

    public function handle(SomeEvent $event)
    {
        $event->show();
        return false;
    }
}

and following is my listener:

use App\Events\SomeEvent;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class EventListener implements ShouldQueue
{
    public function __construct()
    {
        //
    }

    public function handle(SomeEvent $event)
    {
        $event->show();
        return false;
    }
}

and I use the global event helper function to fire event:

event(new SomeEvent('Hello World'));

the event listener really be queued automatically to Redis.

But the document not describe how to queue the event listener to the Amazon SQS. How am i supposed to actually push the event listener method to the Amazon SQS ?

Any help is appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire