mule - Until-Successful failureExpression condition not working -
i created simple flow creates list of names transforms it. transformer throws illegalargumentexception break flow. unfortunately, failureexpression not work though exception thrown. doesn't match exceptions. have included flow , transformer.
here configuration:
<?xml version="1.0" encoding="utf-8"?> <mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"> <spring:beans> <spring:bean name="transf" class="com.until.sucessful.tests.stringappendertransformer" /> <spring:bean id="objectstore" class="org.mule.util.store.simplememoryobjectstore" /> </spring:beans> <http:listener-config name="http_listener_configuration" host="0.0.0.0" port="8081" doc:name="http listener configuration" /> <flow name="untilsuccessfultestsflow"> <http:listener config-ref="http_listener_configuration" path="/mytest" doc:name="http" /> <splitter expression="#[xpath3('//names')]" doc:name="splitter" /> <until-successful maxretries="5" millisbetweenretries="5000" doc:name="until successful" objectstore-ref="objectstore" failureexpression="#[exception java.lang.illegalargumentexception)]"> <vm:outbound-endpoint path="process-vm" exchange-pattern="request-response" /> </until-successful> <logger level="info" message="after scoped processor :: #[payload]" doc:name="logger" /> </flow> <flow name="processorflow"> <vm:inbound-endpoint path="process-vm" exchange-pattern="request-response" /> <logger level="info" message="before component #[payload]" doc:name="logger" /> <transformer ref="transf" /> </flow> </mule> here transformer
public class stringappendertransformer extends abstracttransformer { @override protected object dotransform(object src, string enc) throws transformerexception { string payload = (string) src; list<string> results = new arraylist<>(); system.out.println("upon entry in transformer payload :: " + payload); system.out.println("about return transformer payload :: " + payload.split("\\s+")); int = 1; (string args : payload.split("\\s+")) { system.out.println("" + + " " + args); i++; if (args != null && args.trim().equals("")) { results.add(args); } else { throw new illegalargumentexception("break flow!!!!!!"); } } return results; } }
according documentation : https://docs.mulesoft.com/mule-user-guide/v/3.5/until-successful-scope
failureexpression
specifies expression that, when evaluated true, determines processing of 1 route failure. if no expression provided, exception treated processing failure.
so 2 options, remove expression or sure mel return true. #[exception.causematches("java.lang.illegalargumentexception")]
Comments
Post a Comment