php-rdkafka
php-rdkafka copied to clipboard
Getting librdkafka builtin features
Description
Problem
builtin.features: gzip, snappy, ssl, sasl, regex, lz4, sasl_gssapi, sasl_plain, sasl_scram, plugins, zstd, sasl_oauthbearer, http, oidc. https://github.com/edenhill/librdkafka/blob/b47da0e4eec900d9cb091d2f524e957505dbb513/CONFIGURATION.md It is not possible to detect the available features of librdkafka using custom PHP code. I can't dynamically manage librdkafka options depending on the environment.
Solution
- librdkafka build information in phpinfo.
- There is a constant with librdkafka build information.
- There is a check function (???).
Hint: builtin_features
/BUILT_WITH
https://github.com/edenhill/librdkafka/blob/b47da0e4eec900d9cb091d2f524e957505dbb513/src/rdkafka.c#L2544
Thank you for this request.
CONFIGURATION.md suggests that applications can/should read the default value of the builtin.feature
setting to get the list of available features: https://github.com/edenhill/librdkafka/blob/b47da0e4eec900d9cb091d2f524e957505dbb513/CONFIGURATION.md?plain=1#L6 :
Property | C/P | Range | Default | Importance | Description |
---|---|---|---|---|---|
builtin.features | * | gzip, snappy, ssl, sasl, regex, lz4, sasl_gssapi, sasl_plain, sasl_scram, plugins, zstd, sasl_oauthbearer, http, oidc | low | Indicates the builtin features for this build of librdkafka. An application can either query this value or attempt to set it with its list of required features to check for library support. Type: CSV flags |
As a confirmation for this, the kcat
tool does exactly that: https://github.com/edenhill/kcat/blob/3ffe04f170cebf5f2ab86accd7581b076eb81619/kcat.c#L1293-L1327
Currently php-rdkafka doesn't implement Conf::get(), but we can still read configuration values through Conf::dump() :
$conf = new RdKafka\Conf();
$features = $conf->dump()['builtin.features'];
I've created a separate issue for the get() method: https://github.com/arnaud-lb/php-rdkafka/issues/527