Skip to content

Impossible send null payload (tombstone) because interface Serializer do not allow return null #1229

@Hubbitus

Description

@Hubbitus

Payload to send defined by serializer in the RdKafkaProducer::send:

        $payload = $this->serializer->toString($message);

Where serializer is the instance of a class, implementing Enqueue\RdKafka\Serializer interface. There method toString has signature:

    public function toString(RdKafkaMessage $message): string;

So, in my class, I just can't return null! Please change the return type to ?string.

Using nulls as payload is common practice also known as tombstones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions