| 1 | <?php |
||
| 13 | class SqsFifoConnector extends SqsConnector |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Establish a queue connection. |
||
| 17 | * |
||
| 18 | * @param array $config |
||
| 19 | * @return \Illuminate\Contracts\Queue\Queue |
||
| 20 | */ |
||
| 21 | public function connect(array $config) |
||
| 22 | { |
||
| 23 | $config = $this->getDefaultConfiguration($config); |
||
| 24 | |||
| 25 | if ($config['key'] && $config['secret']) { |
||
| 26 | $config['credentials'] = Arr::only($config, ['key', 'secret']); |
||
| 27 | } |
||
| 28 | |||
| 29 | $options = $config['options'] ?? []; |
||
| 30 | unset($config['options']); |
||
| 31 | |||
| 32 | $queue = Arr::get($options, 'type') === 'fifo' ? new SqsFifoQueue( |
||
| 33 | new SqsClient($config), |
||
| 34 | $config['queue'], |
||
| 35 | $config['prefix'] ?? '', |
||
| 36 | $options, |
||
| 37 | ) : new SqsQueue( |
||
|
|
|||
| 38 | new SqsClient($config), |
||
| 39 | $config['queue'], |
||
| 40 | $config['prefix'] ?? '', |
||
| 41 | $options, |
||
| 42 | ); |
||
| 43 | |||
| 44 | return $queue; |
||
| 45 | } |
||
| 46 | } |
||
| 47 |