@Test public void testSyncSend() throws ExecutionException, InterruptedException { int id = (int) (System.currentTimeMillis() / 1000); SendResult result = producer.syncSend(id); logger.info("[testSyncSend][发送编号：[{}] 发送结果：[{}]]", id, result); new CountDownLatch(1).await(); }
public SendResult syncSend(Integer id) throws ExecutionException, InterruptedException { Demo05Message message = new Demo05Message(); message.setId(id); return kafkaTemplate.send(Demo05Message.TOPIC, message).get(); }
Demo05Producer { public SendResult syncSend(Integer id) throws ExecutionException, InterruptedException { Demo05Message message = new Demo05Message(); message.setId(id); return kafkaTemplate.send(Demo05Message.TOPIC, message).get(); } }
Demo05Producer { public SendResult syncSend(Integer id) throws ExecutionException, InterruptedException { Demo05Message message = new Demo05Message(); message.setId(id); return kafkaTemplate.send(Demo05Message.TOPIC, message).get(); }  }
Demo05Producer { public SendResult syncSend(Integer id) throws ExecutionException, InterruptedException { Demo05Message message = new Demo05Message(); message.setId(id); return kafkaTemplate.send(Demo05Message.TOPIC, message).get(); }  SendResult syncSend(Integer id); }
Demo05Producer { public SendResult syncSend(Integer id) throws ExecutionException, InterruptedException { Demo05Message message = new Demo05Message(); message.setId(id); return kafkaTemplate.send(Demo05Message.TOPIC, message).get(); }  SendResult syncSend(Integer id);  }