初学者kafka的java客户端遇到了一个问题。
public class SimpleKafkaProducer {
private static final Logger logger = Logger.getLogger(SimpleKafkaProducer.class);
private void execMsgSend() {
Properties props = new Properties();
props.put("metadata.broker.list", "192.168.70.181:9092");
props.put("serializer.class", "kafka.serializer.StringEncoder");
props.put("key.serializer.class", "kafka.serializer.StringEncoder");
props.put("request.required.acks", "0");
ProducerConfig config = new ProducerConfig(props);
logger.info("set config info(" + config + ") ok.");
Producer<String, String> procuder = new Producer<>(config);
String topic = "mytopic&