Mule MEL表达式问题

Mule MEL表达式问题,mule,mel,Mule,Mel,我定义了一个全局函数,如下所示 <configuration doc:name="Configuration"> <expression-language autoResolveVariables="true"> <import class="java.text.SimpleDateFormat" /> <global-functions> def convertDate(shiftD

我定义了一个全局函数,如下所示

<configuration doc:name="Configuration">
    <expression-language autoResolveVariables="true">
        <import class="java.text.SimpleDateFormat" />
        <global-functions>
            def convertDate(shiftDate){
                dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                return dateFormat.format(shiftDate);
            }            
        </global-functions>         
    </expression-language>
</configuration>

我做错了什么?非常感谢。

你把梅尔和旧的表达方式混为一谈了

这是老式的:
xpath://address/@payloadID

这是MEL:
xpath('//address/@payloadID')。value

因此,您需要使用:

<logger
   message="Convert Date #[convertDate(xpath('//address/@payloadID').value)]"
   level="DEBUG" />

见:

org.mule.api.expression.InvalidExpressionException: [Error: unexpected end of statement]
[Near : {... convertDate(xpath://address/@payloadID) ....}]
<logger
   message="Convert Date #[convertDate(xpath('//address/@payloadID').value)]"
   level="DEBUG" />