简体   繁体   中英

Unable to consume message from ActiveMQ due to “received expired message”

I am getting below debug statement, and my message listener is not consuming any messages.

22:25:17.870 [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] DEBUG oaactivemq.ActiveMQMessageConsumer - ID:CONSUM-1401814509338-1:1:1:1 received expired message: MessageDispatch {commandId = 0, responseRequired = false, consumerId = ID:CONSUM-1401814509338-1:1:1:1, destination = topic://Topic.ALL, message = 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, destination = topic://Topic.ALL, transactionId = null, expiration = 1401814515925, timestamp = 1401814514925, arrival = 0, brokerInTime = 1401814514934, brokerOutTime = 1401814514934, correlationId = null, replyTo = null, persistent = false, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = 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=Update, _oid=51e8e5c3e4b0cc716bff43cc, _type=NodeServer, _eventtype=attribute, _repository=qdb, _userid=null}, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = { "_eventtype" : "attribute" , "_operation" :...kAddress"}]}}, redeliveryCounter = 0}


Please find my spring config below:

<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>

Please help me to figure out what I am missing..

If your producer is sending messages with a very short expiration value then they could be expiring before they get to the consumer. However in a lot of cases this sort of error arises because the clocks on the sender and receiver are not sync'd and so the message appears to have expired when it really shouldn't have. The solution might be to ensure that your machines are all sync'd using NTP.

There is another alternative should syncing the clocks not be possible which is to use the ActiveMQ TimeStampPlugin to update the timestamp on incoming messages before sending them on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM