Skip to content

Expose helper to construct dropped messages in accumulator (Message.toDrop(datum)) #217

@yhl25

Description

@yhl25

Summary

Expose a helper on Message to construct a dropped message from a Datum, so users can explicitly emit drops from an accumulator (and other UDFs) to allow the watermark to progress and tracked windows/messages to be cleaned up.

Proposed API:

// Builds a Message from the given Datum with drop tags set, so the message is not
// forwarded to the next vertex but still allows the accumulator to advance the
// watermark and release tracked state.
public static Message toDrop(Datum datum);

This complements the existing new Message(datum) constructor used in StreamSorterFactory.java.

Motivation

Today there is no clean way for an accumulator to signal "I have handled this datum but don't want to forward it." Users that omit output for some inputs (e.g. blackhole / filter / multiplexer-style accumulators) end up retaining tracked windows and messages, which leads to unbounded memory growth.

Related: numaproj/numaflow-python#356

Example usage

@Override
public void processMessage(Datum datum, OutputStreamObserver outputStream) {
    if (shouldDrop(datum)) {
        outputStream.send(Message.toDrop(datum));
        return;
    }
    outputStream.send(new Message(datum));
}

Acceptance criteria

  • Message.toDrop(datum) constructs a Message from a Datum with drop tags set.
  • Emitting such a message from an accumulator progresses the watermark and cleans up tracked windows/messages.
  • Message is not forwarded to the next vertex.
  • Unit tests covering accumulator drop behavior.
  • Example/docs updated to show the drop pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions