Import serializer class name

This commit is contained in:
Anton Tananaev 2025-01-01 07:04:00 -08:00
parent 6bb6386eeb
commit 732c2719fb

View File

@ -1,5 +1,5 @@
/*
* Copyright 2022 Anton Tananaev (anton@traccar.org)
* Copyright 2022 - 2024 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.serialization.StringSerializer;
import org.traccar.config.Config;
import org.traccar.config.Keys;
@ -37,8 +38,8 @@ public class PositionForwarderKafka implements PositionForwarder {
Properties properties = new Properties();
properties.put("bootstrap.servers", config.getString(Keys.FORWARD_URL));
properties.put("acks", "all");
properties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
properties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
properties.put("key.serializer", StringSerializer.class.getName());
properties.put("value.serializer", StringSerializer.class.getName());
producer = new KafkaProducer<>(properties);
topic = config.getString(Keys.FORWARD_TOPIC);
}