I have the use case that I need to wait 2 hours before consuming messages from an AMQP (we use Rabbit) queue.
EDIT: To clarify my use case... I need each individual message to wait 2 hours before being read. E.g. Message 1 arrives at 10am and Message 2 arrives at 10:15. I need Message 1 to be read at 12p and Message 2 to be read at 12:15p.
We are using Spring Integration 3.x.
The int-amqp:inbound-channel-adapter
is message driven and doesn't have a polling option from what I can find.
A couple things I've thought of:
- Set
auto-startup
to false and manually start the inbound channel adapter using a quartz job. - Create my own custom
SimpleMessageListenerContainer
that is based on polling (not sure how easy this would be) - Configure a "delay queue" in rabbitmq using this method: How to create a delayed queue in RabbitMQ?
- EDIT: add 4th option: Use
delayer
to delay each message for 2 hours: http://docs.spring.io/spring-integration/docs/3.0.2.RELEASE/reference/html/messaging-endpoints-chapter.html#delayer
Any suggestions?