Skip to content

Adjust KafkaConsumerMessage to always return an array for headers #63

@antonkomarev

Description

@antonkomarev

Jobcloud\Kafka\Message\KafkaConsumerMessage right now has this signature:

public function __construct(
    string $topicName,
    int $partition,
    int $offset,
    int $timestamp,
    $key,
    $body,
    ?array $headers
) {

Is there any reason why headers is nullable? What are the use cases for null value?

I see that headers are casting to array right now:

return new KafkaConsumerMessage(
    (string) $message->topic_name,
    (int) $message->partition,
    (int) $message->offset,
    (int) $message->timestamp,
    $message->key,
    $message->payload,
    (array) $message->headers
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions