How can to create a JavaScript Hello World in a Mule component -


i trying build simple script inside mule component can't seem find documentation on how me started.

the javascript component reference shares no ideas on how simple run.

here simple example:

javascript in mule component

you send json encoded array , script return sum. simple!

there flow:

<flow name="calculateflow1" doc:name="calculateflow1">     <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8089" doc:name="http"/>     <byte-array-to-string-transformer doc:name="byte array string"/>     <scripting:component doc:name="javascript">         <scripting:script engine="javascript">             <scripting:text><![cdata[                 var = eval('(' + payload + ')');                 (var = 0, sum = 0; < a.length; sum += a[i++]);                 message.setpayload(sum + "");                 result = message;         ]]></scripting:text>          </scripting:script>     </scripting:component> </flow> 

variables given mule: message, payload.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -