import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
+import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.common.errors.WakeupException;
import org.apache.kafka.common.serialization.StringDeserializer;
public class SimpleConsumer
{
private long consumed = 0;
- private KafkaConsumer<String, String> consumer;
+ private Consumer<String, String> consumer;
private Lock lock = new ReentrantLock();
private Condition stopped = lock.newCondition();
props.put("key.deserializer", StringDeserializer.class.getName());
props.put("value.deserializer", StringDeserializer.class.getName());
- KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
+ Consumer<String, String> consumer = new KafkaConsumer<>(props);
// end::create[]
this.consumer = consumer;
}
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;
{
private final String id;
private final String topic;
- private final KafkaProducer<String, String> producer;
+ private final Producer<String, String> producer;
private long produced = 0;
props.put("key.serializer", StringSerializer.class.getName());
props.put("value.serializer", StringSerializer.class.getName());
- KafkaProducer<String, String> producer = new KafkaProducer<>(props);
+ Producer<String, String> producer = new KafkaProducer<>(props);
// end::create[]
this.id = clientId;