Skip to content

Commit

Permalink
Merge pull request #554 from maximetassy/add-network-protocol
Browse files Browse the repository at this point in the history
Fix #553, add possibility to define network protocol in config
  • Loading branch information
adm-bome authored Jul 12, 2023
2 parents e93f2f8 + 2aeeb04 commit 86315a4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,26 @@ If for some reason you don't want the connection lazy you can turn it off by set
],
```

### Network Protocol

By default, the network protocol used for connection is tcp.
If for some reason you want to use another network protocol, you can add the extra value in your config options.
Available protocols : `tcp`, `ssl`, `tls`

```php
'connections' => [
// ...

'rabbitmq' => [
// ...

'network_protocol' => 'tcp',
],

// ...
],
```

### Octane support

Starting with 13.3.0, this package supports [Laravel Octane](https://laravel.com/docs/octane) out of the box.
Expand Down
8 changes: 8 additions & 0 deletions src/Queue/Connection/ConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static function make(array $config = []): AMQPConnectionConfig

self::getHostFromConfig($connectionConfig, $config);
self::getHeartbeatFromConfig($connectionConfig, $config);
self::getNetworkProtocolFromConfig($connectionConfig, $config);
});
}

Expand Down Expand Up @@ -90,4 +91,11 @@ protected static function getHeartbeatFromConfig(AMQPConnectionConfig $connectio
$connectionConfig->setHeartbeat((int) $heartbeat);
}
}

protected static function getNetworkProtocolFromConfig(AMQPConnectionConfig $connectionConfig, array $config): void
{
if ($networkProtocol = Arr::get($config, 'network_protocol')) {
$connectionConfig->setNetworkProtocol($networkProtocol);
}
}
}

0 comments on commit 86315a4

Please sign in to comment.