【问题标题】:Camel ActiveMQ: Consuming messages based on the JMSTimestampCamel ActiveMQ:基于 JMSTimestamp 消费消息
【发布时间】:2017-09-07 00:03:38
【问题描述】:

我已经定义了一个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 id="date" class="java.util.Date"  scope="prototype"/>  

【问题讨论】:

    标签: apache-camel activemq


    【解决方案1】:

    根据您的解释,我认为您的选择器有问题

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

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

    我认为你应该尝试类似的方法:

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

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 2016-02-02
      • 2016-03-31
      • 2012-07-11
      • 2016-10-24
      • 2015-11-25
      • 1970-01-01
      • 2021-03-17
      • 2022-01-19
      • 2019-04-02
      相关资源
      最近更新 更多