我在接收消息从侦听器发回发布者方面遇到问题。我正进入(状态 ** AmqpReplyTimeoutException **。下面是我要发布到队列中的Publisher的代码。
for(CsvWrapperPojo item : items){
resultList.addAll(item.getDbResultList());
for(CSVPojo pojo :item.getQueueRequestList()){
sampleResponseMessageRabbitConverterFuture= asyncRabbitTemplate.convertSendAndReceive("spring-boot-rabbitmq-Interactive.async_Solve_InteractiveMsg", "Interactive_RequestQueue", pojo);
//CSVPojo res =(CSVPojo)rabbitTemplate.convertSendAndReceive("spring-boot-rabbitmq-Interactive.async_Solve_InteractiveMsg", "Interactive_RequestQueue", pojo);
System.out.println("heyyyyyy:" + sampleResponseMessageRabbitConverterFuture.get().getLatitute());
//resultList.add(res);
//resultList.add(sampleResponseMessageRabbitConverterFuture.get());
}
}
通过使用它,我可以发布到队列中,下面有用户代码。
@EnableRabbit
public class ListenerQueueSubscriber {
@RabbitHandler
@RabbitListener(containerFactory = "simpleMessageListenerContainerFactory", queues ="Interactive_RequestQueue")
public void subscribeToRequestQueue(@Payload CSVPojo sampleRequestMessage, Message message) throws InterruptedException {
System.out.println("inside listener");
sampleRequestMessage.setResult("Hello");
Thread.sleep(120000);
System.out.println("After sleep:" +sampleRequestMessage.getLongitude());
//return sampleRequestMessage;
}
}
使用上述订阅者可以收听消息,然后我添加“ 你好”,然后睡眠2分钟,然后我必须将消息从发布地接收回发布者。但是不幸的是,没收到带有 Hello 的消息,并附加了** AmqpReplyTimeoutException **,请帮助实现此行为。
提前谢谢!!!!