mirror of
https://github.com/traccar/traccar.git
synced 2025-01-08 11:47:49 +08:00
Import serializer class name
This commit is contained in:
parent
6bb6386eeb
commit
732c2719fb
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.KafkaProducer;
|
||||||
import org.apache.kafka.clients.producer.Producer;
|
import org.apache.kafka.clients.producer.Producer;
|
||||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||||
|
import org.apache.kafka.common.serialization.StringSerializer;
|
||||||
import org.traccar.config.Config;
|
import org.traccar.config.Config;
|
||||||
import org.traccar.config.Keys;
|
import org.traccar.config.Keys;
|
||||||
|
|
||||||
@ -37,8 +38,8 @@ public class PositionForwarderKafka implements PositionForwarder {
|
|||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.put("bootstrap.servers", config.getString(Keys.FORWARD_URL));
|
properties.put("bootstrap.servers", config.getString(Keys.FORWARD_URL));
|
||||||
properties.put("acks", "all");
|
properties.put("acks", "all");
|
||||||
properties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
|
properties.put("key.serializer", StringSerializer.class.getName());
|
||||||
properties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
|
properties.put("value.serializer", StringSerializer.class.getName());
|
||||||
producer = new KafkaProducer<>(properties);
|
producer = new KafkaProducer<>(properties);
|
||||||
topic = config.getString(Keys.FORWARD_TOPIC);
|
topic = config.getString(Keys.FORWARD_TOPIC);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user