【发布时间】:2014-07-28 08:09:24
【问题描述】:
我有一个用例,我需要等待 2 个小时才能使用来自 AMQP(我们使用 Rabbit)队列的消息。
编辑:为了澄清我的用例...我需要每条消息等待 2 小时才能被阅读。例如。消息 1 于上午 10 点到达,消息 2 于 10:15 到达。我需要在下午 12 点阅读消息 1,在下午 12:15 阅读消息 2。
我们正在使用 Spring Integration 3.x。
int-amqp:inbound-channel-adapter 是消息驱动的,没有我能找到的轮询选项。
我想到的几件事:
- 将
auto-startup设置为 false 并使用石英作业手动启动入站通道适配器。 - 创建我自己的基于轮询的自定义
SimpleMessageListenerContainer(不确定这有多容易) - 使用这个方法在rabbitmq中配置一个“延迟队列”:How to create a delayed queue in RabbitMQ?
- 编辑:添加第 4 个选项:使用
delayer将每条消息延迟 2 小时:http://docs.spring.io/spring-integration/docs/3.0.2.RELEASE/reference/html/messaging-endpoints-chapter.html#delayer
有什么建议吗?
【问题讨论】:
标签: spring rabbitmq spring-integration spring-amqp