Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml Mule-如何在Mule JDBC查询中引用字符串查询参数?_Xml_Json_Jdbc_Mule - Fatal编程技术网

Xml Mule-如何在Mule JDBC查询中引用字符串查询参数?

Xml Mule-如何在Mule JDBC查询中引用字符串查询参数?,xml,json,jdbc,mule,Xml,Json,Jdbc,Mule,我的xml如下 <?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit="http://www.mulesoft.org/schema/mule/apikit" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:doc="http://www.mulesoft.

我的xml如下

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit="http://www.mulesoft.org/schema/mule/apikit" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core 
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd" version="EE-3.5.1">
    <apikit:config name="flights-config" raml="flights.raml" consoleEnabled="false" consolePath="console" doc:name="Router" />
    <apikit:mapping-exception-strategy name="flights-apiKitGlobalExceptionMapping" doc:name="Mapping Exception Strategy">
        <apikit:mapping statusCode="404">
            <apikit:exception value="org.mule.module.apikit.exception.NotFoundException" />
            <set-property propertyName="Content-Type" value="application/json" doc:name="Property" />
            <set-payload value="{ &quot;message&quot;: &quot;Resource not found&quot; }" doc:name="Set Payload" />
        </apikit:mapping>
        <apikit:mapping statusCode="405">
            <apikit:exception value="org.mule.module.apikit.exception.MethodNotAllowedException" />
            <set-property propertyName="Content-Type" value="application/json" doc:name="Property" />
            <set-payload value="{ &quot;message&quot;: &quot;Method not allowed&quot; }" doc:name="Set Payload" />
        </apikit:mapping>
        <apikit:mapping statusCode="415">
            <apikit:exception value="org.mule.module.apikit.exception.UnsupportedMediaTypeException" />
            <set-property propertyName="Content-Type" value="application/json" doc:name="Property" />
            <set-payload value="{ &quot;message&quot;: &quot;Unsupported media type&quot; }" doc:name="Set Payload" />
        </apikit:mapping>
        <apikit:mapping statusCode="406">
            <apikit:exception value="org.mule.module.apikit.exception.NotAcceptableException" />
            <set-property propertyName="Content-Type" value="application/json" doc:name="Property" />
            <set-payload value="{ &quot;message&quot;: &quot;Not acceptable&quot; }" doc:name="Set Payload" />
        </apikit:mapping>
        <apikit:mapping statusCode="400">
            <apikit:exception value="org.mule.module.apikit.exception.BadRequestException" />
            <set-property propertyName="Content-Type" value="application/json" doc:name="Property" />
            <set-payload value="{ &quot;message&quot;: &quot;Bad request&quot; }" doc:name="Set Payload" />
        </apikit:mapping>
    </apikit:mapping-exception-strategy>
    <db:mysql-config name="MySQL_Configuration" url="jdbc:mysql://my.connection.details" doc:name="MySQL Configuration" />
    <flow name="flights-main" doc:name="flights-main">
        <http:inbound-endpoint address="http://localhost:8082" doc:name="HTTP" exchange-pattern="request-response" />
        <apikit:router config-ref="flights-config" doc:name="APIkit Router" />

        <db:select config-ref="MySQL_Configuration" doc:name="Database">
            <db:parameterized-query><![CDATA[select * from currentFlights where destination = #[payload] and availableSeats > 0;]]></db:parameterized-query>

        </db:select>
        <json:object-to-json-transformer doc:name="Object to JSON" />
        <exception-strategy ref="flights-apiKitGlobalExceptionMapping" doc:name="Reference Exception Strategy" />
    </flow>
    <flow name="get:/flights:flights-config" doc:name="get:/flights:flights-config">
        <set-payload value="#[message.inboundProperties[destination]]" doc:name="Set Payload"/>
    </flow>
</mule>

我不得不删除一些链接来发布这个问题url是Nevermind,当我尝试下面的方法时,它奏效了。感谢大家阅读[message.inboundProperties['destination']]