Hi I have a very simple code to just send out one message, the topic is created automatically, but the message just cannot be sent out. I also tried to change the configuration, the result is still the same. Sorry to bother you all with this silly question.
For your information, the kafka server is running on a docker container, which is run in a ubuntu server vm. The test class is run from IntelliJ IDEA on the host, which is a amc os x. public static void main(String[] args) { String topic = "test3"; Properties props = new Properties(); props.put("serializer.class", "kafka.serializer.StringEncoder"); props.put("metadata.broker.list", "192.168.144.10:29092"); // props.put("retry.backoff.ms", "1000"); // props.put("message.send.max.retries", "10"); // props.put("topic.metadata.refresh.interval.ms", "0"); Producer<Integer, String> producer = new Producer<Integer, String>(new ProducerConfig(props)); int messageNo = 1; String messageStr = new String("Message_" + messageNo); producer.send(new KeyedMessage<Integer, String>(topic, messageStr)); }