Spring Integration:消息正在重新传递到JMS事务回滚上的队列

时间:2018-01-30 20:01:02

标签: spring spring-integration

我有一个Spring Integration应用程序(Spring Version 4.3.1.RELEASE),它有一个监听程序,用于从Solace(版本7.0.0.63)队列中使用JMS消息。

我希望在JMS事务中使用消息。如果在消息消耗期间存在异常,我希望回滚事务并回滚消息。根据日志,我看到消息正在从队列中读取并处理直到我的Spring Integration流程结束,但我看到JMS事务在处理后回滚。此问题仅适用于某些消息,并且某些消息已成功处理,没有任何问题。以下是日志中显示的JMS侦听器配置和错误消息。

JMS侦听器配置:

    <int-jms:message-driven-channel-adapter
    id="appMessageDrivenChannelAdapter"
    send-timeout="5000"
    max-messages-per-task="-1"
    idle-task-execution-limit="100"
    max-concurrent-consumers="1"
    connection-factory="appCachedConnectionFactory"
    destination="appInQueue" 
    channel="appChannel" 
    error-channel="defaultErrorChannel"
    acknowledge="transacted"/>

  <bean id="appCachedConnectionFactory" 
    class="org.springframework.jms.connection.CachingConnectionFactory">
    <property name="targetConnectionFactory" ref="appConnectionFactory" />
    <property name="cacheConsumers" value="false" />
    <property name="reconnectOnException" value="true" />
</bean> 

  <bean id="appConnectionFactory" 
  class="org.springframework.jndi.JndiObjectFactoryBean" >
    <property name="jndiTemplate">
        <ref bean="jndiTemplate" />
    </property>
    <property name="jndiName">
        <value>jndiName</value>
    </property>
    <property name="lookupOnStartup" value="true" />
    <property name="cache" value="true" />
</bean>

日志中的错误消息:

 Execution of JMS message listener failed, and no ErrorHandler has been set.</L_MSG>
javax.jms.TransactionRolledBackException: Error comitting - transaction rolled back (Transaction '5238' unexpectedly rolled back during commit attempt. (((Client name:   Local addr:    Remote addr: ) - )  com.solacesystems.jcsmp.JCSMPErrorResponseException: 503: Message Consume Failure [Subcode:48]))
    at sun.reflect.GeneratedConstructorAccessor1531.newInstance(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_92]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_92]
    at com.solacesystems.jms.impl.JMSExceptionValue.newInstance(JMSExceptionValue.java:32) ~[jms-7.0.0.63.jar:?]
    at com.solacesystems.jms.impl.JCSMPExceptionMapper$ArrayListMapper.get(JCSMPExceptionMapper.java:31) ~[jms-7.0.0.63.jar:?]
    at com.solacesystems.jms.impl.JCSMPExceptionMapper.get(JCSMPExceptionMapper.java:90) ~[jms-7.0.0.63.jar:?]
    at com.solacesystems.jms.impl.Validator.createJMSException(Validator.java:541) ~[jms-7.0.0.63.jar:?]
    at com.solacesystems.jms.SolSession.commit(SolSession.java:178) ~[jms-7.0.0.63.jar:?]
    at sun.reflect.GeneratedMethodAccessor2985.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_92]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_92]
    at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.invoke(CachingConnectionFactory.java:386) ~[spring-jms-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at com.sun.proxy.$Proxy1010.commit(Unknown Source) ~[?:?]
    at org.springframework.jms.support.JmsUtils.commitIfNecessary(JmsUtils.java:217) ~[spring-jms-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.jms.listener.AbstractMessageListenerContainer.commitIfNecessary(AbstractMessageListenerContainer.java:761) [spring-jms-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:665) [spring-jms-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:319) [spring-jms-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257) [spring-jms-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1166) [spring-jms-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1158) [spring-jms-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1055) [spring-jms-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_92] 

Caused by: com.solacesystems.jcsmp.transaction.RollbackException: Transaction '5238' unexpectedly rolled back during commit attempt. (((Client name:   Local addr:    Remote addr: ) - )  com.solacesystems.jcsmp.JCSMPErrorResponseException: 503: Message Consume Failure [Subcode:48])
    at com.solacesystems.jcsmp.impl.transaction.TSState$StateCommitting.handleAsyncAdCtrl(TSState.java:528) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.impl.transaction.TransactedSessionImpl.handleControlMessage(TransactedSessionImpl.java:326) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.impl.transaction.TransactedSessionManager.dispatchAssuredCtrlMessage(TransactedSessionManager.java:91) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.impl.transaction.TransactedSessionManagerSmf.handleAsyncAssuredCtrlMessage(TransactedSessionManagerSmf.java:167) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.impl.transaction.TransactedSessionManager.handleAsyncAssuredCtrlMessage(TransactedSessionManager.java:79) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.handleAssuredCtrlMsg(TcpClientChannel.java:1544) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.handleMessage(TcpClientChannel.java:1498) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.nio.impl.SubscriberMessageReader.processRead(SubscriberMessageReader.java:97) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.nio.impl.SubscriberMessageReader.read(SubscriberMessageReader.java:132) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.smf.SimpleSmfClient.read(SimpleSmfClient.java:1127) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.nio.impl.SyncEventDispatcherReactor.processReactorChannels(SyncEventDispatcherReactor.java:206) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.nio.impl.SyncEventDispatcherReactor.eventLoop(SyncEventDispatcherReactor.java:157) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.nio.impl.SyncEventDispatcherReactor$SEDReactorThread.run(SyncEventDispatcherReactor.java:338) ~[jcsmp-7.0.0.63.jar:?]
... 1 more


Caused by: com.solacesystems.jcsmp.JCSMPErrorResponseException: 503: Message Consume Failure
    at com.solacesystems.jcsmp.impl.transaction.TransactedSessionManagerSmf.handleAsyncAssuredCtrlMessage(TransactedSessionManagerSmf.java:153) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.impl.transaction.TransactedSessionManager.handleAsyncAssuredCtrlMessage(TransactedSessionManager.java:79) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.handleAssuredCtrlMsg(TcpClientChannel.java:1544) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.handleMessage(TcpClientChannel.java:1498) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.nio.impl.SubscriberMessageReader.processRead(SubscriberMessageReader.java:97) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.nio.impl.SubscriberMessageReader.read(SubscriberMessageReader.java:132) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.smf.SimpleSmfClient.read(SimpleSmfClient.java:1127) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.nio.impl.SyncEventDispatcherReactor.processReactorChannels(SyncEventDispatcherReactor.java:206) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.nio.impl.SyncEventDispatcherReactor.eventLoop(SyncEventDispatcherReactor.java:157) ~[jcsmp-7.0.0.63.jar:?]
    at com.solacesystems.jcsmp.protocol.nio.impl.SyncEventDispatcherReactor$SEDReactorThread.run(SyncEventDispatcherReactor.java:338) ~[jcsmp-7.0.0.63.jar:?]
...

0 个答案:

没有答案