Beispiel verwendet das Interface, um die erzeugte Instanz abzulegen
authorKai Moritz <kai@juplo.de>
Fri, 9 Jun 2023 09:16:42 +0000 (11:16 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 11 Jun 2023 18:15:56 +0000 (20:15 +0200)
src/main/java/de/juplo/kafka/SimpleProducer.java

index 9fcaa6e..9e3bad7 100644 (file)
@@ -1,6 +1,7 @@
 package de.juplo.kafka;
 
 import lombok.extern.slf4j.Slf4j;
+import org.apache.kafka.clients.producer.Producer;
 import org.apache.kafka.clients.producer.KafkaProducer;
 import org.apache.kafka.clients.producer.ProducerRecord;
 import org.apache.kafka.common.serialization.StringSerializer;
@@ -13,7 +14,7 @@ public class SimpleProducer
 {
   private final String id;
   private final String topic;
-  private final KafkaProducer<String, String> producer;
+  private final Producer<String, String> producer;
 
   private long produced = 0;
   private volatile boolean running = true;