spring-boot - 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 **. 请帮助实现此行为。
提前致谢!!!!
解决方案
推荐阅读
- python - 如何在 Python 中将隐马尔可夫模型可视化为集群?
- postgresql - 用于创建索引的 Aurora PostgreSQL 临时存储问题
- python - 使用 fastAPI 从 MongoDb 获取数据时出错
- r - if_else is true, make NA for range of columns
- r - 在森林图中命名第一列的问题
- postgresql - Pgbouncer 是否响应 kill 命令?
- python - 将 matplotlib.pyplot 导入为 plt,尽管 matplotlib 已安装并正常工作
- reactjs - Storybook - 通过控件更改 chartjs 值
- sql - 获取表中不同列的最新 NOT NULL 值,按公共列分组
- flutter - 如何修复错误:无法将参数类型“函数”分配给参数类型“无效函数()?”。- “功能”来自“飞镖:核心”