%dw 2.0
import * from dw::Runtime
var jsonValue = {
value: '{"name": "Mariano"}' as Binary {encoding: "UTF-8"},
encoding: "UTF-8",
properties: {},
mimeType: "application/json"
}
var Utils = "fun sum(a,b) = a +b"
output application/json
---
{
"execute_ok" : evalUrl("classpath://org/mule/weave/v2/engine/runtime_evalUrl/example.dwl", {"payload": jsonValue }),
"execute_ok_withValue" : evalUrl("classpath://org/mule/weave/v2/engine/runtime_evalUrl/example.dwl", {}, {"payload": {name: "Mariano"}})
}
evalUrl
evalUrl(url: String, readerInputs: Dictionary<ReaderInput> = {}, inputValues: Dictionary<Any> = {}, configuration: RuntimeExecutionConfiguration = {}): EvalSuccess | ExecutionFailure
Evaluates the script at the specified URL.
Experimental: This function is an experimental feature that is subject to change or removal from future versions of DataWeave.
Parameters
Name | Description |
---|---|
|
Name of the file execute. |
|
Inputs to read and bind to the execution. |
|
Inputs to bind directly to the execution. |
|
The runtime configuration. |
Example
This example shows how evalUrl
behaves with different inputs.