首页 文章

Camel ActiveMQ:使用基于JMSTimestamp的消息

提问于
浏览
1

我已经定义了一个 Route ,它消耗来自队列的消息没有任何问题,现在我正在尝试使用已经在队列中的消息12小时,我有想法使用 selector ,但不知道如何使用它与 JMSTimestamp 符合12小时标准 .

这是 Route

<route id="INBOUND.RECEIVE.IN">
    <from
        uri="activemq:queue:QXL.INBOUND.RECEIVE.IN?selector=JMSTimestamp%3D${date.time}&amp;concurrentConsumers=10&amp;destination.consumer.prefetchSize=0&amp;deliveryPersistent=true&amp;username=admin01&amp;password=001!admin01001!" />
    <pipeline>
        <bean method="inboundReceive" ref="logipalServices"/>
    </pipeline>
</route>

这是日期bean

<bean id="date" class="java.util.Date"  scope="prototype"/>

1 回答

  • 0

    根据您的解释, I think something is wrong with your selector .

    JMSTimestamp%3D${date.time} 表示 JMSTimestamp = ${date.time}

    这意味着您正在使用 exact JMSTimestamp 查找所有消息 . 由于Date.getTime()以毫秒为单位返回时间,因此您不太可能从队列中检索任何消息 .

    我想你应该尝试类似的东西:

    JMSTimestamp > current date - 12 hours (pseudo code for selector)
    

    我希望这能帮到您 .

相关问题