0
respostas

Ao executar o código o tópico não é criado

package com.br.alura;

import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.serialization.StringSerializer;

import java.util.Map;
import java.util.Properties;

public class NewOrderMain {

    public static void main(String[] args) {
    var producer = new KafkaProducer<String, String>(properties());
        var value = "123344, 34455, 67899";
        var record = new ProducerRecord<String, String>("ECOMMERCE_NEW_ORDER",value, value);
    producer.send(record);
    }

    private static Properties properties() {
        var properties = new Properties();
        properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "127.0.0.1:9092");
        properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
        properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());

        return properties;
    }
}
gabi@DESKTOP-8L6ARFQ:/mnt/c/kafka$ bin/kafka-topics.sh --list   --bootstrap-server localhost:9092
LOJA_NOVO_PEDIDO
__consumer_offsets
quickstart-events
teste