Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.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
Mule Studio如何创建全局变量_Mule_Mule Studio - Fatal编程技术网

Mule Studio如何创建全局变量

Mule Studio如何创建全局变量,mule,mule-studio,Mule,Mule Studio,我的测试骡子应用程序。 我使用curl-json将数据发送到http端点,并使用transforms-json将对象和插入名为(#[message.payload.name])的数据库 我使用catch异常策略来保留错误日志(案例唯一名称) 我想用字段#[message.payload.name]中的条件更新我的表 -mean Update mytable set Firstname=#[message.payload.name] 但in-catch异常策略无法访问#[message.paylo

我的测试骡子应用程序。 我使用curl-json将数据发送到http端点,并使用transforms-json将对象和插入名为(#[message.payload.name])的数据库

我使用catch异常策略来保留错误日志(案例唯一名称)

我想用字段#[message.payload.name]中的条件更新我的表 -mean Update mytable set Firstname=#[message.payload.name]

但in-catch异常策略无法访问#[message.payload.name]

我的配置

  <?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xmlns:json="http://www.mulesoft.org/schema/mule/json"
    xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.3.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd 
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd ">
    <data-mapper:config name="Mapper" transformationGraphPath="mapper.grf" doc:name="DataMapper"></data-mapper:config>
    <jdbc-ee:mysql-data-source name="MySQL_Data_Source1" url="jdbc:mysql://localhost:3306/mule" user="root" password="1234" transactionIsolation="UNSPECIFIED" doc:name="MySQL Data Source"/>
    <jdbc-ee:connector name="Database" dataSource-ref="MySQL_Data_Source1" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"/>
    <flow name="httpPostTestFlow1" doc:name="httpPostTestFlow1"> 
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="httpPost" doc:name="httpPost"></http:inbound-endpoint>

        <json:json-to-object-transformer doc:name="JSON to Object" returnClass="java.util.Map"></json:json-to-object-transformer>


                <jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="INSERT_TOKEN"  connector-ref="Database" doc:name="Database">
                    <jdbc-ee:query key="INSERT_TOKEN" value="insert into users(FirstName) values(#[message.payload.name]);"/>
                </jdbc-ee:outbound-endpoint>


              <!--  <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="80" path="post-debug.php" contentType="application/x-www-form-urlencoded" doc:name="post-debug.php"/> --> 


         <catch-exception-strategy doc:name="Catch Exception Strategy">
            <expression-component doc:name="Create error response">#[message.payload = "{\"status\":\"error\", \"message\":\"" + exception.cause.message + "\"}"]</expression-component>
            <jdbc-ee:outbound-endpoint exchange-pattern="one-way"   connector-ref="Database" doc:name="Database" queryTimeout="-1" queryKey="UPDATE_TOKEN">
                    <jdbc-ee:query key="UPDATE_TOKEN" value="update users SET fail_message = #[message.payload]"/>
                </jdbc-ee:outbound-endpoint>
        </catch-exception-strategy>


    </flow>
</mule>

#[message.payload=“{\”状态\“:\”错误\“,\”消息\“:\”+异常.cause.message+“\”}]

根据标题,您希望有某种全局变量,一种方法是您可以尝试使用flowVars作为快速修复。使用Mule Studio时,它与Variable(在Transformers下)相同


您在捕获异常策略中得到的消息是异常。

文档内容较少,非常感谢