josegonzalez/cakephp-queuesadilla

Add support to listen to worker events

rodrigorm opened this issue · 3 comments

When using then QueuesadillaShell I need to listen to Worker so I can react to some events in my CakePHP application.

Maybe a mapper between League\Event and Cake\Event

This would definitely be something very useful.
We already talked about this topic before.

In the meantime, you can simply subclass the QueuesadillaShell and override the QueuesadillaShell::getWorker method.

public function getWorker($engine, $logger) {
        $worker->attachListener('Worker.job.failure', function ($event) {
            ...
        });
        return $worker;
}

This is what I will do for now. :)