public void publish(byte[] event, String Id) throws ExecutionException, InterruptedException { logger.debug("Send message"); RecordMetadata m = kafkaProducer.send(new ProducerRecord<String, byte[]>("events", Id, event)).get(); System.out.println("Message produced, offset: " + m.offset()); System.out.println("Message produced, partition : " + m.partition()); System.out.println("Message produced, topic: " + m.topic()); }
public void onCompletion(RecordMetadata recordMetadata, Exception e) { if (e != null) { System.out.println("Error producing to topic " + recordMetadata.topic()); e.printStackTrace(); } }