Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mule Performing a string manipulation

Tags:

mule

What is the best way to perform a string manipulation. I wish to perform a substring on a email address to extract the domain detail and populate this to a variable. a java transformer is a possibilty, but i was hoping if i could use a message enricher with a expression to perform this operation. pardon me but i am still a greenhorn on Mule.

here is the excerpt from my mule flow which is failing with error cannot resolve method string length.

 <enricher target="#[flowVars['FromAddressDomain']]" doc:name="Message Enricher"> 
        <expression-transformer expression="#[ payload.fromAddr.substring(payload.fromAddr.lastIndexOf('@')+ 1,payload.fromAddr.lenth())]" doc:name="Expression"></expression-transformer>  
    </enricher>
like image 444
SanSharma Avatar asked Mar 03 '26 11:03

SanSharma


1 Answers

Simply use:

<set-variable variableName="FromAddressDomain"
     value="#[org.mule.util.StringUtils.substringAfter(payload.fromAddr, '@')]" />
like image 140
David Dossot Avatar answered Mar 06 '26 00:03

David Dossot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!