@Test public void testSyncSendFailure() throws InterruptedException { int id = (int) (System.currentTimeMillis() / 1000); producer.syncSend(id, "error"); logger.info("[testSyncSend][发送编号：[{}] 发送成功]", id); new CountDownLatch(1).await(); }
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); }
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); } }
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); }  }
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); }
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);  }