Ao executar o código abaixo estou recebendo mensagem de erro devido ao ".get();" Alguém consegue me ajudar?
import java.util.Properties;
public class NewOrderMain {
public static void main(String[] args){
var producer = new KafkaProducer<String, String>(properties());
var value = "132132,67523,7894589745";
var record = new ProducerRecord<>("ECOMMERCE_NEW_ORDER",value, value);
producer.send(record,(data, ex)->{
if(ex !=null) {
ex.printStackTrace();
return;
}
System.out.println("Sucesso enviando" + data.topic()+ ":::partition"+ data.partition()+"/ffset" +data.offset() + "/timestamp(" + data.timestamp());
}).get();
}
private static Properties properties(){
var properties = new Properties();
properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,"127.0.0.1:9092");
properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
return properties;
}
}
java: Unhandled exception type java.lang.InterruptedException