【问题标题】:Unable to consume message from ActiveMQ due to "received expired message"由于“收到过期消息”,无法使用来自 ActiveMQ 的消息
【发布时间】:2014-06-03 17:14:12
【问题描述】:

我低于调试语句,我的消息监听器没有使用任何消息。

22:25:17.870 [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] 调试 o.a.activemq.ActiveMQMessageConsumer - ID:CONSUM-1401814509338-1:1:1:1 收到过期消息: MessageDispatch {commandId = 0,responseRequired = false,consumerId = ID:CONSUM-1401814509338-1:1:1:1,目的地=主题://Topic.ALL, 消息 = ActiveMQTextMessage {commandId = 23284887, responseRequired = false, messageId = ID:PROC-1398663597609-0:1:1:1:23284883, originalDestination = null, originalTransactionId = null, producerId = ID:PROC-1398663597609-0:1:1:1, 目的地 = topic://Topic.ALL, transactionId = null,过期 = 1401814515925,时间戳 = 1401814514925,到达 = 0,brokerInTime = 1401814514934, brokerOutTime = 1401814514934,correlationId = null,replyTo = null, 持久性 = false,类型 = null,优先级 = 4,groupID = null, groupSequence = 0,targetConsumerId = null,compressed = false,userID = null,内容 = org.apache.activemq.util.ByteSequence@2fec90f6,marshalledProperties = org.apache.activemq.util.ByteSequence@62a08837, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {_componentid=_EPSYNC_READWRITE,_attributename=networkAddress, _operation=更新, _oid=51e8e5c3e4b0cc716bff43cc, _type=NodeServer, _eventtype=attribute, _repository=qdb, _userid=null}, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false,文本 = {“_eventtype”:“属性” , "_operation" :...kAddress"}]}}, redeliveryCounter = 0}


请在下面找到我的 spring 配置:

<bean id="qConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
        <property name="targetConnectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL">
                    <value>tcp://localhost:61616?wireFormat.maxInactivityDuration=0</value>
                </property>
            </bean>
        </property>
</bean>

<bean id="qMessageListener" class="com.xyz.listener.QManifestListener" />

<jms:listener-container destination-type="topic" 
        container-type="default" connection-factory="qConnectionFactory"
        acknowledge="auto" cache="auto">
        <jms:listener destination="Topic.ALL" ref="qMessageListener"
            method="onMessage" />
</jms:listener-container>

请帮我弄清楚我错过了什么..

【问题讨论】:

    标签: java spring activemq spring-jms


    【解决方案1】:

    如果您的生产者发送的消息的过期值非常短,那么它们可能在到达消费者之前就过期了。然而,在很多情况下,会出现这种错误,因为发送方和接收方的时钟没有同步,因此消息似乎已经过期,而实际上它不应该过期。解决方案可能是确保您的机器都使用 NTP 进行同步。

    如果无法同步时钟,还有另一种选择,即使用ActiveMQ TimeStampPlugin 在发送消息之前更新传入消息的时间戳。

    【讨论】:

    • 非常感谢蒂姆!我的系统时间有 5 秒延迟(因为它指向不同的 ntp 服务器),在使用普通 ntp 服务器更新后.. 它工作正常。
    猜你喜欢
    • 2012-05-30
    • 2013-08-13
    • 2019-07-30
    • 2018-07-05
    • 1970-01-01
    • 2016-03-27
    • 2019-02-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多