Skip to content

Kafka Tombstone with Reactive Messaging #155

@BastianSperrhacke-Otto

Description

@BastianSperrhacke-Otto

Hi there.
Currently I am implementing a Kafka-Message-Publisher using mp reactive messaging.
Behind the scenes I use quarkus which comes with the smallrye implementation of the spec.

Our Kafka Topic is configured to "compact" which generally means, that the most recent message related to a given ID will be kept without being deleting by the kafka system.
Now I have the problem to delete the recent message which means to get rid of the last message of that ID.
For this purpose the kafka Guidelines recommend to send a so called "Tombstone", which is a Message with the ID in the Metadata and a NULL-Message.
And the NULL-Message is the problem: Due to the spec of the Emitter I use the message must not be null:

public interface Emitter<T> {
    /**
     * Sends a message to the channel.
     *
     * @param <M> the <em>Message</em> type
     * @param **msg the <em>Message</em> to send, must not be {@code null}**
     * @throws IllegalStateException if the channel has been cancelled or terminated or if an overflow strategy of
     *         {@link OnOverflow.Strategy#THROW_EXCEPTION THROW_EXCEPTION} or {@link OnOverflow.Strategy#BUFFER BUFFER} is
     *         configured and the emitter overflows.
     */
    <M extends Message<? extends T>> void send(M msg);

Are there any thoughts or even solutions on that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions