producer.accept(interactive); } finally { interactive.close();
/** * Write to the topic with the given name a record with the specified key and value. The message is flushed immediately. * * @param topic the name of the topic; may not be null * @param key the key; may not be null * @param value the value; may not be null * @return this producer instance to allow chaining methods together */ default InteractiveProducer<K, V> write(String topic, K key, V value) { return write(new ProducerRecord<>(topic, key, value)); }