Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting librdkafka builtin features #525

Open
maxm86545 opened this issue Jun 13, 2022 · 1 comment
Open

Getting librdkafka builtin features #525

maxm86545 opened this issue Jun 13, 2022 · 1 comment
Labels

Comments

@maxm86545
Copy link

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

@arnaud-lb
Copy link
Owner

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: #527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants