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

io.deephaven.kafka.ingest.ConsumerRecordToStreamPublisherAdapter Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
/**
 * Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
 */
package io.deephaven.kafka.ingest;

import io.deephaven.stream.StreamPublisher;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.time.Duration;
import java.util.List;

/**
 * Converter from a stream of Kafka records to a Deephaven StreamPublisher.
 */
public interface ConsumerRecordToStreamPublisherAdapter extends StreamPublisher {

    /**
     * Propagate a failure from the Kafka consumer to this StreamPublisher.
     *
     * @param cause The failure to propagate
     */
    void propagateFailure(@NotNull Throwable cause);

    /**
     * Consume a List of Kafka records, producing zero or more rows in the output.
     *
     * @param receiveTime the time, in nanoseconds since the epoch, the records were received in this process
     * @param records the records received from {@link org.apache.kafka.clients.consumer.KafkaConsumer#poll(Duration)}.
     * @return the number of bytes processed
     * @throws IOException if there was an error writing to the output table
     */
    long consumeRecords(long receiveTime, @NotNull List> records) throws IOException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy