我已经定义了一个全局函数如下
<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>
但是当通过记录器调用时似乎什么都没有发生
<logger message="Convert Date #[convertDate(xpath://address/@timestamp)]" level="DEBUG" doc:name="Logger"/>
xpath 表达式 xpath://address/@timestamp 产生 2014-10-29T15:23:07
但在我看到的记录器之前
xpath-branch:/address/@timestamp 为:org.dom4j.tree.DefaultAttribute@6452310a [属性:名称时间戳值“2014-10-29T15:23:07”]
错误信息如下
org.mule.api.expression.InvalidExpressionException: [Error: unexpected end of statement]
[Near : {... convertDate(xpath://address/@payloadID) ....}]
我在这里做错了什么?非常感谢。