Interface KafkaCluster.InteractiveProducer<K,​V>

  • Type Parameters:
    K - the type of key
    V - the type of value
    All Superinterfaces:
    AutoCloseable, Closeable
    Enclosing class:
    KafkaCluster

    public static interface KafkaCluster.InteractiveProducer<K,​V>
    extends Closeable
    A simple interactive Kafka producer for use with the cluster.
    • Method Detail

      • write

        default KafkaCluster.InteractiveProducer<K,​V> write​(String topic,
                                                                  K key,
                                                                  V value)
        Write to the topic with the given name a record with the specified key and value. The message is flushed immediately.
        Parameters:
        topic - the name of the topic; may not be null
        key - the key; may not be null
        value - the value; may not be null
        Returns:
        this producer instance to allow chaining methods together
      • write

        KafkaCluster.InteractiveProducer<K,​V> write​(org.apache.kafka.clients.producer.ProducerRecord<K,​V> record)
        Write the specified record to the topic with the given name. The message is flushed immediately.
        Parameters:
        record - the record; may not be null
        Returns:
        this producer instance to allow chaining methods together
      • close

        void close()
        Close this producer's connection to Kafka and clean up all resources.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable