Skip to content

Conversation

@MortalFlesh
Copy link

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 php-enqueue/enqueue-dev#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?

@aand18
Copy link

aand18 commented Jan 8, 2020

Wow! It would be nice if this got merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants