首页 > 解决方案 > AMQP 无法从侦听器接收回消息

问题描述

我在接收从侦听器返回到发布者的消息时遇到问题。我收到 **AmqpReplyTimeoutException **。下面是发布者的代码,我从中发布到队列。

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 **. 请帮助实现此行为。

提前致谢!!!!

标签: spring-bootrabbitmqspring-amqpspring-rabbit

解决方案


推荐阅读