From: Kai Moritz Date: Sat, 2 Apr 2022 21:15:04 +0000 (+0200) Subject: Vorlage X-Git-Tag: rest-producer--vorlage---lvm-2-tage~7 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=090e5a0621ac26443e5c7c38678e4ff7ae2033e0;p=demos%2Fkafka%2Ftraining Vorlage --- diff --git a/src/main/java/de/juplo/kafka/RestProducer.java b/src/main/java/de/juplo/kafka/RestProducer.java index 19f70ba..d2e5712 100644 --- a/src/main/java/de/juplo/kafka/RestProducer.java +++ b/src/main/java/de/juplo/kafka/RestProducer.java @@ -57,48 +57,10 @@ public class RestProducer value // Value ); - producer.send(record, (metadata, e) -> - { - long now = System.currentTimeMillis(); - if (e == null) - { - // HANDLE SUCCESS - produced++; - result.setResult(new ProduceSuccess(metadata.partition(), metadata.offset())); - log.debug( - "{} - Sent key={} message={} partition={}/{} timestamp={} latency={}ms", - id, - record.key(), - record.value(), - metadata.partition(), - metadata.offset(), - metadata.timestamp(), - now - time - ); - } - else - { - // HANDLE ERROR - result.setErrorResult(new ProduceFailure(e)); - log.error( - "{} - ERROR key={} timestamp={} latency={}ms: {}", - id, - record.key(), - metadata == null ? -1 : metadata.timestamp(), - now - time, - e.toString() - ); - } - }); - - long now = System.currentTimeMillis(); - log.trace( - "{} - Queued #{} key={} latency={}ms", - id, - value, - record.key(), - now - time - ); + // TODO: Nachricht versenden und Feedback geben + // Tipp: + // result.setResult(new ProduceSuccess(metadata.partition(), metadata.offset())); + // result.setErrorResult(new ProduceFailure(e)); return result; }