Skip to content

Commit

Permalink
chore: add @arnaud-lb code review
Browse files Browse the repository at this point in the history
  • Loading branch information
qkdreyer committed Aug 30, 2024
1 parent 83c5807 commit 17db791
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ if test "$PHP_RDKAFKA" != "no"; then
])

AC_CHECK_LIB($LIBNAME,[rd_kafka_controllerid],[
#if RD_KAFKA_VERSION >= 0x010000ff
AC_DEFINE(HAS_RD_KAFKA_CONTROLLERID,1,[ ])
#else
AC_MSG_WARN([controllerid is broken on 0.11.x])
#endif
],[
AC_MSG_WARN([controllerid is not available])
])
Expand Down
2 changes: 1 addition & 1 deletion kafka_consumer.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ PHP_METHOD(RdKafka_KafkaConsumer, getMetadata)
Returns the current ControllerId (controller broker id) as reported in broker metadata */
PHP_METHOD(RdKafka_KafkaConsumer, getControllerId)
{
kafka_object *intern;
object_intern *intern;
zend_long timeout;

if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timeout) == FAILURE) {
Expand Down
8 changes: 4 additions & 4 deletions tests/controller_id.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ Display controller id
--SKIPIF--
<?php
require __DIR__ . '/integration-tests-check.php';
RD_KAFKA_BUILD_VERSION < 0x000b0500 && die("skip librdkafka < 0.11.5");
RD_KAFKA_BUILD_VERSION < 0x010000ff && die("skip librdkafka < 1.0.0");
--FILE--
<?php
require __DIR__ . '/integration-tests-check.php';

$conf = new RdKafka\Conf();
$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));

echo (new RdKafka\Producer($conf))->getControllerId(0) . \PHP_EOL;
echo (new RdKafka\Consumer($conf))->getControllerId(0) . \PHP_EOL;
echo (new RdKafka\Producer($conf))->getControllerId(10*1000) . \PHP_EOL;
echo (new RdKafka\Consumer($conf))->getControllerId(10*1000) . \PHP_EOL;

$conf = new RdKafka\Conf();
$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));
$conf->set('group.id', 'test');

echo (new RdKafka\KafkaConsumer($conf))->getControllerId(0) . \PHP_EOL;
echo (new RdKafka\KafkaConsumer($conf))->getControllerId(10*1000) . \PHP_EOL;
--EXPECT--
-1
-1
Expand Down

0 comments on commit 17db791

Please sign in to comment.