@Test public void testSyncSend() throws InterruptedException { int id = (int) (System.currentTimeMillis() / 1000); String result = producer.syncSend(id); logger.info("[testSyncSend][发送编号：[{}] 发送成功 消费结果：[{}]]", id, result); new CountDownLatch(1).await(); }
public String syncSend(Integer id) { Demo14Message message = new Demo14Message(); message.setId(id); CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); return (String) rabbitTemplate.convertSendAndReceive(Demo14Message.EXCHANGE, Demo14Message.ROUTING_KEY, message, correlationData); }
Demo14Producer { public String syncSend(Integer id) { Demo14Message message = new Demo14Message(); message.setId(id); CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); return (String) rabbitTemplate.convertSendAndReceive(Demo14Message.EXCHANGE, Demo14Message.ROUTING_KEY, message, correlationData); } }
Demo14Producer { public String syncSend(Integer id) { Demo14Message message = new Demo14Message(); message.setId(id); CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); return (String) rabbitTemplate.convertSendAndReceive(Demo14Message.EXCHANGE, Demo14Message.ROUTING_KEY, message, correlationData); }  }
Demo14Producer { public String syncSend(Integer id) { Demo14Message message = new Demo14Message(); message.setId(id); CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); return (String) rabbitTemplate.convertSendAndReceive(Demo14Message.EXCHANGE, Demo14Message.ROUTING_KEY, message, correlationData); }  String syncSend(Integer id); }
Demo14Producer { public String syncSend(Integer id) { Demo14Message message = new Demo14Message(); message.setId(id); CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); return (String) rabbitTemplate.convertSendAndReceive(Demo14Message.EXCHANGE, Demo14Message.ROUTING_KEY, message, correlationData); }  String syncSend(Integer id);  }