Message.InboundProperty总是返回String - MULE - AnyPoint Studio - APIkit

时间:2014-08-04 04:32:53

标签: api mule mule-studio connector

使用RAML + MULE AnypointStudio(APIkit)开发API。所以在我的RAML文件中,我已经定义了这样的资源。

/player
    post:
        queryParameters:
            year: type: integer
            place: type: string

然后,进入AnyPoint Studio,导入我的.raml文件后,我获得了一个以post方法取消的流程。我使用MySQL Conector插入数据库。问题出在查询中:

INSERT INTO Matches (day,place,max_players)
VALUES (#[message.inboundProperties.'day'],#[message.inboundProperties'place'],
#[message.inboundProperties.'maxPlayers'])

当我调用#[message.inboundProperties.day]时,它返回一个字符串,但我想要一个整数值。

我是MULE的新人,所以如果你能解释我怎么样会很棒。

TY

1 个答案:

答案 0 :(得分:1)

所有查询参数都被视为字符串。您可以使用MEL转换为int。这是一个在Mel表达式中使用Java来将参数解析为int的示例。

#[Integer.parseInt(message.inboundProperties.day)]