Вход Регистрация
Файл: vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php
Строк: 62
<?php

namespace IlluminateQueueConnectors;

use 
AwsSqsSqsClient;
use 
IlluminateQueueSqsQueue;
use 
IlluminateSupportArr;

class 
SqsConnector implements ConnectorInterface
{
    
/**
     * Establish a queue connection.
     *
     * @param  array  $config
     * @return IlluminateContractsQueueQueue
     */
    
public function connect(array $config)
    {
        
$config $this->getDefaultConfiguration($config);

        if (! empty(
$config['key']) && ! empty($config['secret'])) {
            
$config['credentials'] = Arr::only($config, ['key''secret''token']);
        }

        return new 
SqsQueue(
            new 
SqsClient(
                
Arr::except($config, ['token'])
            ),
            
$config['queue'],
            
$config['prefix'] ?? '',
            
$config['suffix'] ?? '',
            
$config['after_commit'] ?? null
        
);
    }

    
/**
     * Get the default configuration for SQS.
     *
     * @param  array  $config
     * @return array
     */
    
protected function getDefaultConfiguration(array $config)
    {
        return 
array_merge([
            
'version' => 'latest',
            
'http' => [
                
'timeout' => 60,
                
'connect_timeout' => 60,
            ],
        ], 
$config);
    }
}
Онлайн: 1
Реклама