我正在尝试在Mule中选择分支以http.query.params
中的参数数量分支吗?
如何将MULE_JDBC_UDATE_COUNT
变量的值返回给客户端?
我的config.xml
<spring:beans>
<spring:bean id="InformixDatasource" name="InformixDatasource" class="org.enhydra.jdbc.standard.StandardDataSource">
<spring:property name="password" value="xxxxx"></spring:property>
<spring:property name="driverName" value="com.informix.jdbc.IfxDriver"></spring:property>
<spring:property name="user" value="informix"></spring:property>
<spring:property name="url" value="jdbc:informix-sqli://browning.frett.ehf:1527/dev:informixserver=ol_brown"></spring:property>
</spring:bean>
</spring:beans>
<jdbc-ee:connector name="InformixConnector" dataSource-ref="InformixDatasource" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"></jdbc-ee:connector>
<flow name="postdrefing_fetch_dataFlow1" doc:name="postdrefing_fetch_dataFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="0.0.0.0" port="8084" doc:name="HTTP" path="postdreifing"></http:inbound-endpoint>
<logger message="before db Choice #[message.payload]" level="INFO" doc:name="Logger"></logger>
<choice doc:name="Choice">
<when expression="message.inboundProperties['dreifing'] != null and message.inboundProperties['dags'] != null or message.inboundProperties['dags'] != null">
<logger message="delete #[message.inboundProperties['http.query.params']]" level="INFO" doc:name="Logger"></logger>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="deleteById" queryTimeout="-1" connector-ref="InformixConnector" doc:name="Delete from nafnadreifing by id">
<jdbc-ee:query key="deleteById" value="DELETE FROM fdr_nafnadreifing WHERE dreifing = #[message.inboundProperties['dreifing']] and dags = TO_DATE(#[message.inboundProperties['dags']],'%d%m%Y')"></jdbc-ee:query>
</jdbc-ee:outbound-endpoint>
<logger message="Deleted #[flowVars['MULE_JDBC_UDATE_COUNT']] rows" level="INFO" doc:name="Logger"></logger>
<set-payload value="Deleted #[flowVars['MULE_JDBC_UDATE_COUNT']] rows" doc:name="Set Payload"/>
</when>
<otherwise>
<logger message="default" level="INFO" doc:name="Logger"></logger>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="selectStatement" queryTimeout="-1" connector-ref="InformixConnector" doc:name="Select all from ibudaskra">
<jdbc-ee:query key="selectStatement" value="SELECT skyring,gata,gata_thgf,husnumer,auka,pnr,hverfi,ibudafjoldi,fjolpostur,athugasemdir,breytt,bannmerki,uppfaert,sortnr,pakki,active,tegund,ibud FROM fdr_ibudaskra"></jdbc-ee:query>
</jdbc-ee:outbound-endpoint>
<json:object-to-json-transformer doc:name="Object to JSON"></json:object-to-json-transformer>
</otherwise>
</choice>
</flow>
答案 0 :(得分:3)
是的,这可能是#[message.inboundProperties['http.query.params']['myQueryParamName']]
之类的。请务必在表达式周围使用#[ ]
,并使用“&amp;&amp;”和'||'用于布尔运算。
<when expression="#[message.inboundProperties['dreifing'] != null && message.inboundProperties['dags'] != null || message.inboundProperties['dags'] != null]">
这个表达式的部分似乎也缺少括号。
使用set-payload
:
<set-payload value="#[flowVars['MULE_JDBC_UDPATE_COUNT']]" />