|
@@ -42,19 +42,4 @@ public class KafkaUtils {
|
|
|
public static void send(KafkaProducer<String, String> producer, String topic, String message) {
|
|
public static void send(KafkaProducer<String, String> producer, String topic, String message) {
|
|
|
producer.send(new ProducerRecord<>(topic, message));
|
|
producer.send(new ProducerRecord<>(topic, message));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-// public static void main(String[] args) {
|
|
|
|
|
-// Properties props = new Properties();
|
|
|
|
|
-// props.put("bootstrap.servers", "http://localhost:9092");
|
|
|
|
|
-// AdminClient adminClient = AdminClient.create(props);
|
|
|
|
|
-// ArrayList<NewTopic> topics = new ArrayList<NewTopic>();
|
|
|
|
|
-// NewTopic newTopic = new NewTopic("test-topic", 1, (short) 1);
|
|
|
|
|
-// topics.add(newTopic);
|
|
|
|
|
-// CreateTopicsResult result = adminClient.createTopics(topics);
|
|
|
|
|
-// try {
|
|
|
|
|
-// result.all().get();
|
|
|
|
|
-// } catch (InterruptedException | ExecutionException e) {
|
|
|
|
|
-// e.printStackTrace();
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
}
|
|
}
|