Skip to content

Commit d91547e

Browse files
committed
[dsn] replace xxx:// to xxx:
1 parent bc544a3 commit d91547e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

RdKafkaConnectionFactory.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ class RdKafkaConnectionFactory implements PsrConnectionFactory
2929
*
3030
* or
3131
*
32-
* rdkafka://host:port
32+
* kafka://host:port
3333
*
3434
* @param array|string $config
3535
*/
36-
public function __construct($config = 'rdkafka://')
36+
public function __construct($config = 'kafka:')
3737
{
38-
if (empty($config) || 'rdkafka://' === $config) {
38+
if (empty($config) || 'kafka:' === $config) {
3939
$config = [];
4040
} elseif (is_string($config)) {
4141
$config = $this->parseDsn($config);
@@ -79,8 +79,8 @@ private function parseDsn($dsn)
7979
'query' => null,
8080
], $dsnConfig);
8181

82-
if ('rdkafka' !== $dsnConfig['scheme']) {
83-
throw new \LogicException(sprintf('The given DSN scheme "%s" is not supported. Could be "rdkafka" only.', $dsnConfig['scheme']));
82+
if ('kafka' !== $dsnConfig['scheme']) {
83+
throw new \LogicException(sprintf('The given DSN scheme "%s" is not supported. Could be "kafka" only.', $dsnConfig['scheme']));
8484
}
8585

8686
$config = [];

Tests/RdKafkaConnectionFactoryTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ public function testThrowNeitherArrayStringNorNullGivenAsConfig()
1818
public function testThrowIfSchemeIsNotBeanstalkAmqp()
1919
{
2020
$this->expectException(\LogicException::class);
21-
$this->expectExceptionMessage('The given DSN scheme "http" is not supported. Could be "rdkafka" only.');
21+
$this->expectExceptionMessage('The given DSN scheme "http" is not supported. Could be "kafka" only.');
2222

2323
new RdKafkaConnectionFactory('http://example.com');
2424
}
2525

2626
public function testThrowIfDsnCouldNotBeParsed()
2727
{
2828
$this->expectException(\LogicException::class);
29-
$this->expectExceptionMessage('Failed to parse DSN "rdkafka://:@/"');
29+
$this->expectExceptionMessage('Failed to parse DSN "kafka://:@/"');
3030

31-
new RdKafkaConnectionFactory('rdkafka://:@/');
31+
new RdKafkaConnectionFactory('kafka://:@/');
3232
}
3333

3434
public function testShouldBeExpectedDefaultConfig()
@@ -50,7 +50,7 @@ public function testShouldBeExpectedDefaultConfig()
5050

5151
public function testShouldBeExpectedDefaultDsnConfig()
5252
{
53-
$factory = new RdKafkaConnectionFactory('rdkafka://');
53+
$factory = new RdKafkaConnectionFactory('kafka:');
5454

5555
$config = $this->getObjectAttribute($factory, 'config');
5656

@@ -81,7 +81,7 @@ public function testShouldParseConfigurationAsExpected($config, $expectedConfig)
8181
public static function provideConfigs()
8282
{
8383
yield [
84-
'rdkafka://theHost:1234?global%5Bgroup.id%5D=group-id',
84+
'kafka://theHost:1234?global%5Bgroup.id%5D=group-id',
8585
[
8686
'global' => [
8787
'metadata.broker.list' => 'theHost:1234',

0 commit comments

Comments
 (0)