2
  1. 我正在尝试让我在 Mule 中选择的分支在参数数量上进行分支,http.query.params这可能吗?

  2. 如何将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>

4

1 回答 1

3
  1. 是的,这是可能的,例如#[message.inboundProperties['http.query.params']['myQueryParamName']]. 一定要#[ ]在你的表达式周围使用,同时使用 '&&' 和 '||' 用于布尔运算。

    <when expression="#[message.inboundProperties['dreifing'] != null &amp;&amp; message.inboundProperties['dags'] != null || message.inboundProperties['dags'] != null]"> 
    

    您似乎也缺少围绕此表达式部分的括号。

  2. 使用set-payload

    <set-payload value="#[flowVars['MULE_JDBC_UDPATE_COUNT']]" />
    
于 2013-06-11T14:56:49.457 回答