Estou usando o IntelliJ 2019.3.3 com o Java 12. Quando sigo os passos do vídeo, ele consegue pegar a referencia do record, mas não consegue acessar os atributos que deveriam vir junto (key, value, partition e offset)
for (var record : records) {
System.out.println("###########################################");
System.out.println("Processing new order, checking for fraud");
System.out.println(record.key()); //erro aqui cannot find symbol, symbol: method key(), location: variable record of type java.lang.Object
System.out.println(record.value()); //erro aqui cannot find symbol, symbol: method value(), location: variable record of type java.lang.Object
System.out.println(record.partition()); //erro aqui cannot find symbol, symbol: method partition(), location: variable record of type java.lang.Object
System.out.println(record.offset()); //erro aqui cannot find symbol, symbol: method offset(), location: variable record of type java.lang.Object
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Order Processed");
System.out.println("###########################################");
Tentei outras soluções como
records.foreach( record -> {
System.out.println("###########################################");
System.out.println("Processing new order, checking for fraud");
System.out.println(record.key()); //erro aqui cannot find symbol, symbol: method key(), location: variable record of type java.lang.Object
System.out.println(record.value()); //erro aqui cannot find symbol, symbol: method value(), location: variable record of type java.lang.Object
System.out.println(record.partition()); //erro aqui cannot find symbol, symbol: method partition(), location: variable record of type java.lang.Object
System.out.println(record.offset()); //erro aqui cannot find symbol, symbol: method offset(), location: variable record of type java.lang.Object
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Order Processed");
System.out.println("###########################################");
}
Mas todas apresentaram o mesmo erro. Podem me ajudar?