### Question:
Demo04Producer { public void syncSend(Integer id, String headerValue) { MessageProperties messageProperties = new MessageProperties(); messageProperties.setHeader(Demo04Message.HEADER_KEY, headerValue); Message message = rabbitTemplate.getMessageConverter().toMessage( new Demo04Message().setId(id), messageProperties); rabbitTemplate.send(Demo04Message.EXCHANGE, null, message); }  void syncSend(Integer id, String headerValue);  }### Answer:
@Test public void testSyncSendSuccess() throws InterruptedException { int id = (int) (System.currentTimeMillis() / 1000); producer.syncSend(id, Demo04Message.HEADER_VALUE); logger.info("[testSyncSend][发送编号：[{}] 发送成功]", id); new CountDownLatch(1).await(); }
@Test public void testSyncSendFailure() throws InterruptedException { int id = (int) (System.currentTimeMillis() / 1000); producer.syncSend(id, "error"); logger.info("[testSyncSend][发送编号：[{}] 发送成功]", id); new CountDownLatch(1).await(); }