All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.numaproj.numaflow.batchmapper.BatchResponse Maven / Gradle / Ivy

The newest version!
package io.numaproj.numaflow.batchmapper;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * BatchResponse is used to collect and manage a batch of Message objects.
 */
public class BatchResponse {
    @Getter
    private final String id;
    private final List messages;

    /**
     * Constructs a BatchResponse with a specified ID.
     *
     * @param id the unique identifier for this batch response
     */
    public BatchResponse(String id) {
        this.id = id;
        this.messages = new ArrayList<>();
    }

    /**
     * Appends a Message to the batch.
     *
     * @param msg the Message to be added to the batch
     *
     * @return the current BatchResponse instance for method chaining
     */
    public BatchResponse append(Message msg) {
        this.messages.add(msg);
        return this;
    }

    /**
     * Retrieves the list of Messages in the batch.
     *
     * @return the list of Messages
     */
    public List getItems() {
        return messages;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy