mule配置文件

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:spring="http://www.springframework.org/schema/beans"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:http="http://www.mulesoft.org/schema/mule/http"
      xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
      xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
      xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
      xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp"
      xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio"
      xmlns:file="http://www.mulesoft.org/schema/mule/file"
   xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
   xmlns:jee="http://www.springframework.org/schema/jee"
   xmlns:util="http://www.springframework.org/schema/util"
   xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc"
      xsi:schemaLocation="
        http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.mulesoft.org/schema/mule/corehttp://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
        http://www.mulesoft.org/schema/mule/httphttp://www.mulesoft.org/schema/mule/http/3.1/mule-http.xsd
        http://www.mulesoft.org/schema/mule/vmhttp://www.mulesoft.org/schema/mule/vm/3.1/mule-vm.xsd
        http://www.mulesoft.org/schema/mule/jmshttp://www.mulesoft.org/schema/mule/jms/3.1/mule-jms.xsd
        http://www.mulesoft.org/schema/mule/tcphttp://www.mulesoft.org/schema/mule/tcp/3.1/mule-tcp.xsd
        http://www.mulesoft.org/schema/mule/cxfhttp://www.mulesoft.org/schema/mule/cxf/3.1/mule-cxf.xsd
        http://www.mulesoft.org/schema/mule/stdiohttp://www.mulesoft.org/schema/mule/stdio/3.1/mule-stdio.xsd
        http://www.mulesoft.org/schema/mule/filehttp://www.mulesoft.org/schema/mule/file/3.1/mule-file.xsd
        http://www.mulesoft.org/schema/mule/jdbchttp://www.mulesoft.org/schema/mule/jdbc/3.1/mule-jdbc.xsd
        http://www.springframework.org/schema/jeehttp://www.springframework.org/schema/jee/spring-jee-3.0.xsd
       http://www.springframework.org/schema/utilhttp://www.springframework.org/schema/util/spring-util-3.0.xsd">

<custom-transformer name="muleservice" class="com.test.cxf.transferCxf" />

<custom-transformer name="stringToInteger" class="com.test.cxf.StringToInteger" />
<custom-transformer name="HttpRequestToNameString"
  class="org.mule.example.hello.HttpRequestToNameString" />
<custom-transformer name="HttpRequestToParameter" class="org.mule.transport.servlet.transformers.HttpRequestToParameter"/>
<custom-transformer name="AToB" class="com.test.cxf.transformer.AToBTransformer"/>
<custom-transformer name="BToA" class="com.test.cxf.transformer.BToATransformer" />

<spring:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  <spring:property name="driverClassName" value="com.mysql.jdbc.Driver"/>
  <spring:property name="url" value="jdbc:mysql://localhost:3306/"/>
  <spring:property name="username" value="root"/>
  <spring:property name="password" value="123"/> 
</spring:bean>

<expression-transformer name="ExtractSymbol">
        <return-argument evaluator="map-payload" expression="symbol" />
    </expression-transformer>
   
   <jdbc:connector name="jdbcConnector" dataSource-ref="dataSource" pollingFrequency="1000" queryTimeout="-1">
     <jdbc:query key="saveUser" value="insert into user_base (username,password,email) values (#[map-payload:username],#[map-payload:password],#[map-payload:email])"/>
     <jdbc:query key="getAllUser" value="select * from user_base u"/>
    </jdbc:connector>

<flow name="in">
  <inbound-endpoint address="http://localhost:8889/service/AToB"     
     exchange-pattern="request-response">
     <cxf:jaxws-service serviceClass="com.test.cxf.newCxf.INewCxf" />
  </inbound-endpoint>
  <component>
   <singleton-object class="com.test.cxf.newCxf.NewCxfImp"></singleton-object>
  </component>
  <custom-transformer class="com.test.cxf.transformer.AToBTransformer"></custom-transformer>
  <flow-ref name="out"/>
</flow>
<flow name="out"> 
  <outbound-endpoint address="http://xop.xiu.com:8080/Demo/cxf/cxftest"     
     responseTransformer-refs="BToA"
     exchange-pattern="request-response">
      <cxf:jaxws-client  serviceClass="com.test.cxf.ICxf" operation="getB" />
  </outbound-endpoint>
</flow>
<flow name="jdbc_store">
  <jdbc:outbound-endpoint queryKey="getAllUser" connector-ref="jdbcConnector" queryTimeout="100" exchange-pattern="request-response">
   <jdbc:transaction action="ALWAYS_BEGIN"/>
  </jdbc:outbound-endpoint>
</flow>
</mule>

原文参照 http://hi.baidu.com/dfx2009/blog/item/e3ec1c5c97d16759faf2c0af.html
添加部分为:

xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.1/mule-pattern.xsd

xmlns:script="http://www.mulesoft.org/schema/mule/scripting"
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/3.2/mule-scripting.xsd

猜你喜欢

转载自liuxueping1987.iteye.com/blog/1534554