Register the custom queue connectors for Horizon.

@return void
179019
protected function registerQueueConnectors()
    {
        $this->app->resolving(QueueManager::class, function ($manager) {
            $manager->addConnector('redis', function () {
                return new RedisConnector($this->app['redis']);
            });
        });
    }
954835
public function register()
    {
        $this->app->singleton('Congraph\Core\Bus\CommandDispatcher', function ($app) {
            return new CommandDispatcher($app, function () use ($app) {
                return $app['Illuminate\Contracts\Queue\Queue'];
            });
        });

        $this->app->alias(
            'Congraph\Core\Bus\CommandDispatcher', 'Illuminate\Contracts\Bus\Dispatcher'
        );

        $this->app->alias(
            'Congraph\Core\Bus\CommandDispatcher', 'Illuminate\Contracts\Bus\QueueingDispatcher'
        );
    }
594311
public function register()
    {
        $this->app->singleton(Dispatcher::class, function ($app) {
            return new Dispatcher($app, function ($connection = null) use ($app) {
                return $app[QueueFactoryContract::class]->connection($connection);
            });
        });

        $this->app->alias(
            Dispatcher::class, DispatcherContract::class
        );

        $this->app->alias(
            Dispatcher::class, QueueingDispatcherContract::class
        );
    }
1173148
protected function registerModelContracts()
    {
        $this->app->bind(AdminUserInterface::class, AdminUserRepository::class);
        $this->app->bind(MenuInterface::class, MenuRepository::class);
        $this->app->bind(PageInterface::class, PageRepository::class);
        $this->app->bind(RoleInterface::class, RoleRepository::class);
        $this->app->bind(SiteCurrencyInterface::class, SiteCurrencyRepository::class);
    }
716549
protected function registerFailingQueueHandler()
    {
        if ($this->eye->laravelVersionIs('>=', '5.2.0')) {
            app(QueueManager::class)->failing(function (JobFailed $e) {
                $this->eye->queue()->failedQueue($e->connectionName,
                                                      $e->job->resolveName(),
                                                      $e->job->getQueue());
            });
        } else {
            app(QueueManager::class)->failing(function ($connection, $job, $data) {
                $this->eye->queue()->failedQueue($connection,
                                                      $this->eye->queue()->resolveLegacyName($job),
                                                      $job->getQueue());
            });
        }
    }
831276
protected function registerAdapterDependencies()
    {
        $this->app->bind('pubsub.redis.redis_client', function ($app, $parameters) {
            return new RedisClient($parameters['config']);
        });

        $this->app->bind('pubsub.gcloud.pub_sub_client', function ($app, $parameters) {
            return new GoogleCloudPubSubClient($parameters['config']);
        });

        $this->app->bind('pubsub.kafka.topic_conf', function () {
            return new \RdKafka\TopicConf();
        });

        $this->app->bind('pubsub.kafka.producer', function () {
            return new \RdKafka\Producer();
        });

        $this->app->bind('pubsub.kafka.conf', function () {
            return new \RdKafka\Conf();
        });

        $this->app->bind('pubsub.kafka.consumer', function ($app, $parameters) {
            return new \RdKafka\KafkaConsumer($parameters['conf']);
        });

        $this->app->bind('pubsub.http.client', function () {
            return new Client();
        });
    }
360843
protected function registerManager()
    {
        $this->app->bindShared('queue', function($app)
        {
            // Once we have an instance of the queue manager, we will register the various
            // resolvers for the queue connectors. These connectors are responsible for
            // creating the classes that accept queue configs and instantiate queues.
            $manager = new QueueManager($app);

            $this->registerConnectors($manager);

            return $manager;
        });

        $this->app->singleton('queue.connection', function ($app) {
            return $app['queue']->connection();
        });
    }
256622
protected function registerConnectionServices()
    {
        // The connection factory is used to create the actual connection instances on
        // the database. We will inject the factory into the manager so that it may
        // make the connections while they are actually needed and not of before.
        $this->app->singleton('db.factory', function ($app) {
            return new ConnectionFactory($app);
        });

        // The database manager is used to resolve various connections, since multiple
        // connections might be managed. It also implements the connection resolver
        // interface which may be used by other components requiring connections.
        $this->app->singleton('db', function ($app) {
            return new DatabaseManager($app, $app['db.factory']);
        });

        $this->app->bind('db.connection', function ($app) {
            return $app['db']->connection();
        });
    }
1242171
public function register()
    {
        $this->app->bindShared('grids', function($app)
        {
            return new GridsShortcuts($app['request']);
        });
        $this->app->alias('grids', 'Sygmaa\Grids\Grids');
    }
315060
protected function registerFailedJobServices()
    {
        $this->app->bindShared('queue.failer', function($app)
        {
            $config = $app['config']['queue.failed'];

            if (isset($config['table'])) {
                return new DatabaseFailedJobProvider($app['db'], $config['database'], $config['table']);
            } else {
                return new NullFailedJobProvider();
            }
        });
    }
922121
protected function registerMemcachedBucketCacheDriver(): void
    {
        $this->app['cache']->extend('couchbase-memcached', function ($app, $config) {
            $prefix = $app['config']['cache.prefix'];
            $credential = $config['sasl'] ?? [];
            $memcachedBucket = $this->app['couchbase.memcached.connector']
                ->connect($config['servers']);

            return new Repository(
                new MemcachedBucketStore(
                    $memcachedBucket,
                    strval($prefix),
                    $config['servers'],
                    $credential
                )
            );
        });
    }
1013593
private function registerServices()
    {
        $this->createServices();

        $this->app->singleton('pragmarx.health.cache', $this->cacheClosure);

        $this->app->singleton(
            'pragmarx.health.resource.checker',
            $this->resourceCheckerClosure
        );

        $this->app->singleton('pragmarx.health', $this->healthServiceClosure);

        $this->app->singleton(
            'pragmarx.health.commands',
            $this->instantiateCommands()
        );
    }
633176
public function register()
    {
        $this->bindConfig();

        $this->app->bind('Tokenly\XcallerClient\Client', function($app) {
            $queue_manager = $this->app->make('Illuminate\Queue\QueueManager');
            $client = new Client(Config::get('xcaller-client.queue_connection'), Config::get('xcaller-client.queue_name'), $queue_manager);
            return $client;
        });
    }
1138120
protected function bootComponentDrivers()
    {
        $this->addRedisSentinelBroadcaster();
        $this->addRedisSentinelCacheStore();

        // This package's Horizon service provider will set up the queue
        // connector a bit differently, so we don't need to do it twice:
        if (! $this->config->shouldIntegrateHorizon) {
            $this->addRedisSentinelQueueConnector();
        }

        // Since version 5.2, Lumen does not include support for sessions by
        // default, so we'll only register the session handler if enabled:
        if ($this->config->supportsSessions) {
            $this->addRedisSentinelSessionHandler();
        }
    }
1353357
protected function registerHorizonServiceProvider()
    {
        $namespace = Str::replaceLast('\\', '', $this->getAppNamespace());

        $appConfig = file_get_contents(config_path('app.php'));

        if (Str::contains($appConfig, $namespace.'\\Providers\\HorizonServiceProvider::class')) {
            return;
        }

        file_put_contents(config_path('app.php'), str_replace(
            "{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL,
            "{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL."        {$namespace}\Providers\HorizonServiceProvider::class,".PHP_EOL,
            $appConfig
        ));

        file_put_contents(app_path('Providers/HorizonServiceProvider.php'), str_replace(
            "namespace App\Providers;",
            "namespace {$namespace}\Providers;",
            file_get_contents(app_path('Providers/HorizonServiceProvider.php'))
        ));
    }
149357
public function loadHorizonConfiguration()
    {
        // We set the config value "redis-sentinel.load_horizon" to FALSE after
        // configuring Horizon connections to skip this step after caching the
        // application configuration via "artisan config:cache":
        if ($this->config->get('redis-sentinel.load_horizon', true) !== true) {
            return;
        }

        $horizonConfig = $this->getSelectedHorizonConnectionConfiguration();
        $options = Arr::get($horizonConfig, 'options', [ ]);
        $options['prefix'] = $this->config->get('horizon.prefix', 'horizon:');

        $horizonConfig['options'] = $options;

        $this->config->set('database.redis-sentinel.horizon', $horizonConfig);
        $this->config->set('redis-sentinel.load_horizon', false);
    }
359943
private function registerBreadcrumbsService()
    {
        $this->singleton(Contracts\Breadcrumbs::class, function ($app) {
            /** @var  \Illuminate\Contracts\Config\Repository  $config */
            $config = $app['config'];

            return new Breadcrumbs(
                $config->get('breadcrumbs.template.supported', []),
                $config->get('breadcrumbs.template.default', '')
            );
        });
    }