php-rdkafka-stubs icon indicating copy to clipboard operation
php-rdkafka-stubs copied to clipboard

Add parsed configuration properties

Open MortalFlesh opened this issue 7 years ago • 1 comments

Hello,

I've parsed all properties from kafka configuration here https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md into PHP classes with constants and proper description.

So for example

Property C/P Range Default Description
client.id * rdkafka Client identifier.
Type: string
message.max.bytes * 1000 .. 1000000000 1000000 Maximum Kafka protocol request message size.
Type: integer

Will be

class GlobalConfig
{
    /**
     * Client identifier.
     *
     * Type: string
     * Default: rdkafka
     */
    public const CLIENT_ID = 'client.id';

    /**
     * Maximum Kafka protocol request message size.
     *
     * Type: integer
     * Range: 1000 .. 1000000000
     * Default: 1000000
     */
    public const MESSAGE_MAX_BYTES = 'message.max.bytes';
}

So I have classes

PHP class Description Consumer/Producer Note
GlobalConfig.php Global configuration properties Both
GlobalConsumer.php Global configuration properties Consumer extends GlobalConfig
GlobalProducer.php Global configuration properties Producer extends GlobalConfig
Topic.php Topic configuration properties Both
TopicConsumer.php Topic configuration properties Consumer extends Topic
TopicProducer.php Topic configuration properties Producer extends Topic

I created an issue https://github.com/php-enqueue/enqueue-dev/issues/464 in php-enqueue repo, but they pointed me at php-rdkafka extension, but I think, this is better place to put those constants.

I'm not sure about namespace and dir structure. What do you think?

MortalFlesh avatar Jun 19 '18 11:06 MortalFlesh

Wow! It would be nice if this got merged!

aand18 avatar Jan 08 '20 10:01 aand18