Mule在异常后不回滚JMS消息

Mule在异常后不回滚JMS消息,jms,mule,Jms,Mule,我的流使用基于cron表达式的消息,我特意添加了一个groovy代码来抛出异常以测试JMS回滚。回滚不会将已使用的消息返回到队列中。我是不是遗漏了什么 这里是mule流,它应该在遇到异常后回滚mule消息 <jms:activemq-connector name="jmsConnector" specification="1.1" brokerURL="tcp://localhost:61616" /> <jms:endpoint name="testqueue" queue=

我的流使用基于cron表达式的消息,我特意添加了一个groovy代码来抛出异常以测试JMS回滚。回滚不会将已使用的消息返回到队列中。我是不是遗漏了什么

这里是mule流,它应该在遇到异常后回滚mule消息

<jms:activemq-connector name="jmsConnector" specification="1.1" brokerURL="tcp://localhost:61616" />
<jms:endpoint name="testqueue" queue="test.queue" connector-ref="jmsConnector" />

<flow name="quartzBasedDelivery">
    <quartz:inbound-endpoint jobName="deliveryJob" cronExpression="0 0/1 * * * ?">
        <quartz:endpoint-polling-job>
            <quartz:job-endpoint ref="testqueue" />
        </quartz:endpoint-polling-job>
    </quartz:inbound-endpoint>
    <logger message="QUARTZ found message for delivery #[payload]" level="INFO" />
    <scripting:component>
               <scripting:script engine="groovy">
                    throw new java.lang.RuntimeException();
                </scripting:script>
    </scripting:component>
    <file:outbound-endpoint path="/test/out" outputPattern="message-[function:dateStamp].txt" />
    <logger message="Message deliverd" level="INFO" />
</flow>

<flow name="copyFile">
    <file:inbound-endpoint  path="/test/in"/>
    <byte-array-to-string-transformer /> 
    <logger message="COPYFILE found message for test queue #[payload]" level="INFO" />
    <jms:outbound-endpoint queue="test.queue"/> 
</flow>

在您的情况下,JMS消息不会通过
回滚异常策略
重新传递到原始队列,因为您有一个
Quartz
入站端点,它不是事务性的或可靠的。 您可以配置
捕获异常策略
,并显式重新传递消息。注意这些场景,因为您可以创建无限循环

资料来源:


HTH

在您的情况下,JMS消息不会通过
回滚异常策略重新传递到原始队列,因为您有一个
Quartz
入站端点,它不是事务性的或可靠的。 您可以配置
捕获异常策略
,并显式重新传递消息。注意这些场景,因为您可以创建无限循环

资料来源:


HTH

您在哪里配置了事务和回滚异常策略?@Seba默认异常策略回滚事务。所以,尽管我没有提到回滚策略。。。它是隐式的。您在哪里配置了事务和回滚异常策略?@Seba默认异常策略回滚事务。所以,尽管我没有提到回滚策略。。。这是含蓄的。
    Exception stack is:
1. null (java.lang.RuntimeException)
  sun.reflect.NativeConstructorAccessorImpl:-2 (null)
2. java.lang.RuntimeException (javax.script.ScriptException)
  org.codehaus.groovy.jsr223.GroovyScriptEngineImpl:323 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/script/ScriptException.html)
3. Failed to invoke ScriptComponent{quartzBasedDelivery.component.559022270}. Component that caused exception is: ScriptComponent{quartzBasedDelivery.component.559022270}. Message payload is of type: String (org.mule.component.ComponentException)
  org.mule.component.AbstractComponent:148 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/component/ComponentException.html)
********************************************************************************
Root Exception stack trace:
java.lang.RuntimeException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)