Mule not rolling back JMS message after exception -
my flow consumes message based on cron expression , have deliberately added groovy code throw exception testing jms rollback. rollback doesn't return consumed message in queue. missing here ?
here mule flow supposed rollback mule message after exception encountered.
<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 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 test queue #[payload]" level="info" /> <jms:outbound-endpoint queue="test.queue"/> </flow>
here exception thrown flow -
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 invoke scriptcomponent{quartzbaseddelivery.component.559022270}. component caused exception is: scriptcomponent{quartzbaseddelivery.component.559022270}. message payload 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 @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(unknown source) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(unknown source)
in case jms messages won't redelivered originating queue rollback exception strategy
because have quartz
inbound endpoint, wich not transactional or reliable. can configure catch exception strategy
, explicitly redeliver message. careful these scenarios because can create infinite loop.
source: rollback exception strategy
hth
Comments
Post a Comment