java - MULE - Expression Transformer not substituting the flow variable value in expression -
i new mule , java , trying write generic flow transform payload value of flow variable set @ component level. below snippet of flow. how can use expression transformer generic. should execute value stored flow variable , manipulate payload.
<flow name="process_incoming__eflow_messagesflow1" doc:name="process_incoming__eflow_messagesflow1"> <vm:inbound-endpoint exchange-pattern="request-response" path="transformtobod" doc:name="transfor bod vm"/> <logger message="message received bod vm #[payload]" level="info" doc:name="logger"/> <component class="com.efi.radius.components.getmessagetype" doc:name="java - type of bod comming payload"/> <logger message="the bod class trasform #[flowvars.messagetype]" level="info" doc:name="logger"/> <custom-transformer class="com.efi.radius.transformers.xmltobodtransformer" doc:name="java - xml bod transformer"> </custom-transformer> <logger message="the data area map #[flowvars.messagebodtype]" level="info" doc:name="logger"/> <logger message="the payload #[payload]" level="info" doc:name="logger"/> <expression-transformer expression="#[flowvars['messagebodtype']]" doc:name="expression - extract data area"/> </flow>
snippet of getmessagetype.java set flow variable
if (payload.indexof("<processcustomerpartymaster") != -1) { // set message type customer eventcontext.getmessage().setinvocationproperty("messagetype", "com.efi.radius.models.bod.processcustomerpartymastertype"); eventcontext.getmessage().setinvocationproperty("messagebodtype", "#[message.payload.getdataarea().getcustomerpartymaster().get(0)]"); }
i have written custom transformer receive value of "messagetype" correctly , transform follows.
snippet of xmltobodtransformer.java bodclassname = message.getinvocationproperty("messagetype");
this works fine.
if directly write #message.payload.getdataarea().getcustomerpartymaster().get(0)]" in expression transformer working expected want make generic. there way it?
adding error log .
the value of #[flowvars.messagebodtype] "#[message.payload.getdataarea().getcustomerpartymaster().get(0)]" setting in getmessagetype.java shown above
please find snippet of console after running. info [[iquoteintegration].process_iquote_job.stage1.02] (dispatchinglogger.java:197) - bod class trasform com.efi.radius.models.bod.processcustomerpartymastertype com.efi.radius.models.bod.processcustomerpartymastertype info [[iquoteintegration].process_iquote_job.stage1.02] (dispatchinglogger.java:197) - data area map #[message.payload.getdataarea().getcustomerpartymaster().get(0)] info [[iquoteintegration].process_iquote_job.stage1.02] (dispatchinglogger.java:197) - payload com.efi.radius.models.bod.processcustomerpartymastertype@3dcc579c info [[iquoteintegration].process_iquote_job.stage1.02] (dispatchinglogger.java:197) - payload after bod object transformation #[message.payload.getdataarea().getcustomerpartymaster().get(0)] info [[iquoteintegration].process_iquote_job.stage1.02] (dispatchinglogger.java:197) - initialising: 'connector.vm.mule.default.dispatcher.1280679149'. object is: vmmessagedispatcher info [[iquoteintegration].process_iquote_job.stage1.02] (dispatchinglogger.java:197) - starting: 'connector.vm.mule.default.dispatcher.1280679149'. object is: vmmessagedispatcher error [[iquoteintegration].process_iquote_job.stage1.02] (dispatchinglogger.java:341) -
message : failed find entry point component, following resolvers tried failed: [ reflectionentrypointresolver: found many possible methods on object "com.efi.radius.transformers.eflowjobtoradiusjob" accept parameters "{class java.lang.string}", methods matched "[public final java.lang.object org.mule.transformer.abstracttransformer.transform(java.lang.object) throws org.mule.api.transformer.transformerexception, public void org.mule.transformer.abstracttransformer.setname(java.lang.string), public void org.mule.transformer.abstracttransformer.setencoding(java.lang.string), public void org.mule.transformer.abstracttransformer.setmimetype(java.lang.string) throws javax.activation.mimetypeparseexception]" annotatedentrypointresolver: component: eflowjobtoradiusjob{this=b72e07f, name='null', ignorebadinput=false, returnclass=simpledatatype{type=java.lang.object, mimetype='/'}, sourcetypes=[]} doesn't have annotated methods, skipping. callableentrypointresolver: object "eflowjobtoradiusjob{this=b72e07f, name='null', ignorebadinput=false, returnclass=simpledatatype{type=java.lang.object, mimetype='/'}, sourcetypes=[]}" not implement required interface "interface org.mule.api.lifecycle.callable" methodheaderpropertyentrypointresolver: required property "method" not set on event ]
code : mule_error-321
exception stack is: 1. failed find entry point component, following resolvers tried failed: [ reflectionentrypointresolver: found many possible methods on object "com.efi.radius.transformers.eflowjobtoradiusjob" accept parameters "{class java.lang.string}", methods matched "[public final java.lang.object org.mule.transformer.abstracttransformer.transform(java.lang.object) throws org.mule.api.transformer.transformerexception, public void org.mule.transformer.abstracttransformer.setname(java.lang.string), public void org.mule.transformer.abstracttransformer.setencoding(java.lang.string), public void org.mule.transformer.abstracttransformer.setmimetype(java.lang.string) throws javax.activation.mimetypeparseexception]" annotatedentrypointresolver: component: eflowjobtoradiusjob{this=b72e07f, name='null', ignorebadinput=false, returnclass=simpledatatype{type=java.lang.object, mimetype='/'}, sourcetypes=[]} doesn't have annotated methods, skipping. callableentrypointresolver: object "eflowjobtoradiusjob{this=b72e07f, name='null', ignorebadinput=false, returnclass=simpledatatype{type=java.lang.object, mimetype='/'}, sourcetypes=[]}" not implement required interface "interface org.mule.api.lifecycle.callable" methodheaderpropertyentrypointresolver: required property "method" not set on event ] (org.mule.model.resolvers.entrypointnotfoundexception)
org.mule.model.resolvers.defaultentrypointresolverset:52 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/model/resolvers/entrypointnotfoundexception.html)
root exception stack trace: org.mule.model.resolvers.entrypointnotfoundexception: failed find entry point component, following resolvers tried failed: [ reflectionentrypointresolver: found many possible methods on object "com.efi.radius.transformers.eflowjobtoradiusjob" accept parameters "{class java.lang.string}", methods matched "[public final java.lang.object org.mule.transformer.abstracttransformer.transform(java.lang.object) throws org.mule.api.transformer.transformerexception, public void org.mule.transformer.abstracttransformer.setname(java.lang.string), public void org.mule.transformer.abstracttransformer.setencoding(java.lang.string), public void org.mule.transformer.abstracttransformer.setmimetype(java.lang.string) throws javax.activation.mimetypeparseexception]" annotatedentrypointresolver: component: eflowjobtoradiusjob{this=b72e07f, name='null', ignorebadinput=false, returnclass=simpledatatype{type=java.lang.object, mimetype='/'}, sourcetypes=[]} doesn't have annotated methods, skipping. callableentrypointresolver: object "eflowjobtoradiusjob{this=b72e07f, name='null', ignorebadinput=false, returnclass=simpledatatype{type=java.lang.object, mimetype='/'}, sourcetypes=[]}" not implement required interface "interface org.mule.api.lifecycle.callable" methodheaderpropertyentrypointresolver: required property "method" not set on event ]
what want achieve can done, @ least not in way. see, if doing worked nothing stop send, lets mel expression payload in http request , have execute in code mel injection, if will.
i suggest narrow down want make generic, or store such expression in file , use value of message select file have execute.
hth
Comments
Post a Comment