嗨我有一条
的路线<route id="invokeGetMortgageAccountDetails">
<from uri="direct:invokeGetMortgageAccountDetails" />
<removeHeaders pattern="operationNamespace" />
<setHeader headerName="operationName">
<constant>getMortgageDetailsRequest</constant>
</setHeader>
<to uri="cxf:bean:getBastionAcctDetailsClient" />
<removeHeaders pattern="*" />
</route>
现在我想在参数帐户的长度等于8时更改'到uri'。
我是Apache骆驼的新手,互联网上没有非常有用的信息。
我使用的是骆驼版本2.15,我尝试在交换中传递一个名为帐号长度的额外属性,并试图在路线中匹配值,但它不起作用。
处理器:
public void processMortgage(最终Exchange交换)抛出 ServiceException {MessageContentsList messageContentsList = (MessageContentsList)exchange.getIn()。getBody();名单 paramsList = new ArrayList(); String systemID = messageContentsList.get(0)的ToString()修剪(); String brandID = messageContentsList.get(1)的ToString()修剪(); String account = messageContentsList.get(2)的ToString()修剪(); String len = Integer.toString(account.length()); paramsList.add(Constants.HUB); paramsList.add(brandID.toUpperCase()); paramsList.add(帐户); exchange.setProperty(Constants.SystemID,systemID); exchange.setProperty(len,len); exchange.setProperty(Constants.ErrorCode,null); exchange.setProperty( “mortgageAccountNumber” 的Integer.parseInt(帐户)); } 。exchange.getIn()setBody(paramsList); }
路线配置:
<route id="invokeGetMortgageAccountDetails">
<from uri="direct:invokeGetMortgageAccountDetails" /> <removeHeaders pattern="operationNamespace" />
<setHeader headerName="operationName">
<constant>getMortgageDetailsRequest</constant> </setHeader> <choice>
<when>
<simple>${body.len} == '8'</simple>
<to uri="cxf:bean:getPhoebusClient" />
</when>
<otherwise>
<to uri="cxf:bean:getBastionAcctDetailsClient" />
</otherwise>
</choice>
<removeHeaders pattern="*" />
</route>
答案 0 :(得分:1)