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

net.mguenther.kafka.junit.RecordProducer Maven / Gradle / Ivy

Go to download

Provides an embedded Kafka cluster consisting of Apache ZooKeeper, Apache Kafka Brokers and Kafka Connect workers in distributed mode along with a rich set of convenient accessors and fault injectors to interact with the embedded Kafka cluster. Supports working against external clusters as well.

There is a newer version: 3.6.0
Show newest version
package net.mguenther.kafka.junit;

import org.apache.kafka.clients.producer.RecordMetadata;

import java.util.List;

/**
 * Provides the means to send key-value pairs or un-keyed values to a Kafka topic. The send
 * operations a {@code RecordProducer} provides are synchronous in their nature.
 */
public interface RecordProducer {

    /**
     * Sends (un-keyed) values synchronously to a Kafka topic.
     *
     * @param sendRequest
     *      the configuration of the producer and the send operation it has to carry out
     * @param 
     *      refers to the type of values being send
     * @throws RuntimeException
     *      in case there is an error while sending an individual Kafka record to the
     *      designated Kafka broker
     * @throws InterruptedException
     *      in case an interrupt signal has been set
     * @return
     *      unmodifiable {@link java.util.List} that contains metadata on the written
     *      Kafka records
     * @see SendValues
     */
     List send(SendValues sendRequest) throws InterruptedException;

    /**
     * Sends (un-keyed) values synchronously and transactionally to a Kafka topic.
     *
     * @param sendRequest
     *      the configuration of the producer and the send operation it has to carry out
     * @param 
     *      refers to the type of values being send
     * @throws RuntimeException
     *      in case there is an error while sending an individual Kafka record to the
     *      designated Kafka broker
     * @throws InterruptedException
     *      in case an interrupt signal has been set
     * @return
     *      unmodifiable {@link java.util.List} that contains metadata on the written
     *      Kafka records
     * @see SendValuesTransactional
     */
     List send(SendValuesTransactional sendRequest) throws InterruptedException;

    /**
     * Sends key-value pairs synchronously to a Kafka topic.
     *
     * @param sendRequest
     *      the configuration of the producer and the send operation it has to carry out
     * @param 
     *      refers to the type of keys being send
     * @param 
     *      refers to the type of values being send
     * @throws RuntimeException
     *      in case there is an error while sending an individual Kafka record to the
     *      designated Kafka broker
     * @throws InterruptedException
     *      in case an interrupt signal has been set
     * @return
     *      unmodifiable {@link java.util.List} that contains metadata on the written
     *      Kafka records
     * @see SendKeyValues
     */
     List send(SendKeyValues sendRequest) throws InterruptedException;

    /**
     * Sends key-value pairs synchronously and transactionally to a Kafka topic.
     *
     * @param sendRequest
     *      the configuration of the producer and the send operation it has to carry out
     * @param 
     *      refers to the type of keys being send
     * @param 
     *      refers to the type of values being send
     * @throws RuntimeException
     *      in case there is an error while sending an individual Kafka record to the
     *      designated Kafka broker
     * @throws InterruptedException
     *      in case an interrupt signal has been set
     * @return
     *      unmodifiable {@link java.util.List} that contains metadata on the written
     *      Kafka records
     * @see SendKeyValuesTransactional
     */
     List send(SendKeyValuesTransactional sendRequest) throws InterruptedException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy