我在调试语句之下,我的消息监听器没有消耗任何消息。
22:25:17.870 [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] DEBUG o.a.activemq.ActiveMQMessageConsumer - ID:CONSUM-1401814509338-1:1:1:1收到过期消息: 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,到达= 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" :"属性" ," _operation" :... kAddress"}]}},redeliveryCounter = 0}
请在下面找到我的弹簧配置:
<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>
请帮我弄清楚我错过了什么..
答案 0 :(得分:5)
如果您的制作人发送的消息的到期时间非常短,那么他们可能会在到达消费者之前到期。然而,在很多情况下会出现这种错误,因为发送器和接收器上的时钟不同步,因此当消息确实不具有时,消息似乎已经过期。解决方案可能是确保您的计算机全部使用NTP进行同步。
还有另一种选择,应该同步时钟是不可能的,即使用ActiveMQ TimeStampPlugin在发送消息之前更新传入消息的时间戳。