@Test public void testASyncSend() throws InterruptedException { int id = (int) (System.currentTimeMillis() / 1000); producer.asyncSend(id, new SendCallback() { @Override public void onSuccess(SendResult result) { logger.info("[testASyncSend][发送编号：[{}] 发送成功，结果为：[{}]]", id, result); } @Override public void onException(Throwable e) { logger.info("[testASyncSend][发送编号：[{}] 发送异常]]", id, e); } }); new CountDownLatch(1).await(); }
public void asyncSend(Integer id, SendCallback callback) { Demo01Message message = new Demo01Message(); message.setId(id); rocketMQTemplate.asyncSend(Demo01Message.TOPIC, message, callback); }
Demo01Producer { public void asyncSend(Integer id, SendCallback callback) { Demo01Message message = new Demo01Message(); message.setId(id); rocketMQTemplate.asyncSend(Demo01Message.TOPIC, message, callback); } }
Demo01Producer { public void asyncSend(Integer id, SendCallback callback) { Demo01Message message = new Demo01Message(); message.setId(id); rocketMQTemplate.asyncSend(Demo01Message.TOPIC, message, callback); }  }
Demo01Producer { public void asyncSend(Integer id, SendCallback callback) { Demo01Message message = new Demo01Message(); message.setId(id); rocketMQTemplate.asyncSend(Demo01Message.TOPIC, message, callback); }  SendResult syncSend(Integer id); void asyncSend(Integer id, SendCallback callback); void onewaySend(Integer id); }
Demo01Producer { public void asyncSend(Integer id, SendCallback callback) { Demo01Message message = new Demo01Message(); message.setId(id); rocketMQTemplate.asyncSend(Demo01Message.TOPIC, message, callback); }  SendResult syncSend(Integer id); void asyncSend(Integer id, SendCallback callback); void onewaySend(Integer id);  }