for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Noitran\Lumen\Horizon;
use Noitran\Lumen\Horizon\Connectors\RabbitMQConnector;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Support\ServiceProvider;
class HorizonServiceProvider extends ServiceProvider
{
/**
* All of the Horizon event / listener mappings.
*
* @var array
*/
protected $events = [
\Illuminate\Queue\Events\JobFailed::class => [
Listeners\MarshalFailedEvent::class,
],
];
* Register the Horizon job events.
* @return void
protected function registerEvents(): void
$events = $this->app->make(Dispatcher::class);
foreach ($this->events as $event => $listeners) {
foreach ($listeners as $listener) {
$events->listen($event, $listener);
}
* Register the custom queue connectors for Horizon.
protected function registerQueueConnectors(): void
$queue = $this->app['queue'];
$queue->addConnector('rabbitmq', function () {
return new RabbitMQConnector($this->app['events']);
});
* Register any application services.
public function boot(): void
$this->registerEvents();
$this->registerQueueConnectors();