2020-09-25 19:16:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace BeyondCode\LaravelWebSockets\Queue;
|
|
|
|
|
|
|
|
|
|
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
|
|
|
|
|
use Illuminate\Queue\RedisQueue;
|
|
|
|
|
|
|
|
|
|
class AsyncRedisQueue extends RedisQueue
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Get the connection for the queue.
|
|
|
|
|
*
|
|
|
|
|
* @return \BeyondCode\LaravelWebSockets\Contracts\ChannelManager|\Illuminate\Redis\Connections\Connection
|
|
|
|
|
*/
|
|
|
|
|
public function getConnection()
|
|
|
|
|
{
|
2020-09-25 19:16:30 +00:00
|
|
|
$channelManager = $this->container->bound(ChannelManager::class)
|
2020-09-25 19:16:06 +00:00
|
|
|
? $this->container->make(ChannelManager::class)
|
|
|
|
|
: null;
|
|
|
|
|
|
|
|
|
|
return $channelManager && method_exists($channelManager, 'getRedisClient')
|
|
|
|
|
? $channelManager->getRedisClient()
|
|
|
|
|
: parent::getConnection();
|
|
|
|
|
}
|
|
|
|
|
}
|