0

I'm a bit new to camel, so please forgive me if this is a stupid question!

In Camel, I have a list of competing consumers against a queue, queue-1. I'd like each consumer to wait 1 hour between attempts to read the queue, but once an hour has passed, each consumer should continuously poll until it receives a message. Once it receives a message, it should process it, and then wait an hour before attempting another read, and so on.

Here's the route I have set up:

from("aws-sqs://queue-1?accessKey=ABC&secretKey=XYZ&maxMessagesPerPoll=1")
    .unmarshal().base64()
    .unmarshal().serialization()
    .throttle(1)
    .timePeriodMillis(TimeUnit.HOUR.toMillis(1))
    .bean(new ProcessorBean())
    .marshal().serialization()
    .marshal().base64()
    .to("aws-sqs://queue-2?accessKey=ABC&secretKey=XYZ");      

It is my understanding that routes execute synchronously (with the exception of specific components designed to work asynchronously). Based on that understanding, I believe this route satisfies those requirements.

Will this do what I want? Why or why not?

4

1 回答 1

2

您的路线将消耗队列中的一条消息,然后等待一小时。

如果您想等待一个小时然后阅读一条消息,请查看 ScheduledPollConsumer Options (Doc) 一些选项允许使用调度程序,如Quartz2或基于 Spring 的调度程序。

如果您想确定,请使用日志.to("log:com.mycompany.order?level=DEBUG")组件: .

于 2013-10-21T08:59:39.907 回答