### Question:
Demo04Producer { public SendResult syncSend(Integer id) throws ExecutionException, InterruptedException { Demo04Message message = new Demo04Message(); message.setId(id); return kafkaTemplate.send(Demo04Message.TOPIC, message).get(); }  SendResult syncSend(Integer id);  }### Answer:
@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(); }
@Test public void testSyncSendX() throws ExecutionException, InterruptedException { for (int i = 0; i < 100; i++) { int id = (int) (System.currentTimeMillis() / 1000); SendResult result = producer.syncSend(id); logger.info("[testSyncSend][发送编号：[{}] 发送结果：[{}]]", id, result); Thread.sleep(10 * 1000L); } new CountDownLatch(1).await(); }