<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.1/mule-vm.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.1/mule-cxf.xsd">
<!-- Services configuration -->
<model name="amadeus">
<!-- Amadeus web service -->
<service name="AmadeusAirTravelService">
<inbound>
<inbound-endpoint address="${amadeus.endpoint}" exchange-pattern="request-response">
<cxf:jaxws-service>
<cxf:inInterceptors>
<spring:ref bean="masterPricerRequestTemplateSetterInterceptor" />
<spring:ref bean="toOneWaySearchRequestInterceptor" />
</cxf:inInterceptors>
</cxf:jaxws-service>
</inbound-endpoint>
</inbound>
<component>
<spring-object bean="amadeusAirTravelService" />
</component>
</service>
</model>
</mule>
1.1 基本标签
Mule配置文件由以下标签组织成一颗XML元素树:
1.1.1 <model>
定义应用程序中的服务;
1.1.2 <service>
配置一个服务;
1.1.3 <description>
服务的描述内容;
1.1.4 <inbound>
配置入站路由,它们的端点以及入站转换器;
1.1.5 <outbound>
配置一个或多个出站路由,它们的端点以及出站转换器;
1.1.6 <async-reply>
配置一个异步应答路由,它用于异步请求/响应消息中;
1.1.7 <exception-strategy>
配置连接器或模型或服务上的错误处理策略;
1.2 配置设置
将服务组件编织成一个应用程序是由配置文件来完成的,Mule的配置设置是由开发人员负责的,它们包括:
1、服务组件的声明;
2、哪个服务上的端点将接收消息;
3、将消息引入到服务组件之前使用哪个转换器;
4、出站端点上的消息下一步改流向哪里;
5、消息的路由信息将其发送到下一个服务组件。
<endpoint>
使用它声明一个全局范围的端点,在整个Mule应用程序中都可以使用,在一个服务中,"ref="用于引用全局端点:
<file:endpoint name="fileReader" reverseOrder="true" comparator="org.mule.transport.file.comparator.OlderFirstComparator" />
<model> <service name="Priority1"> <file:inbound-endpoint ref="fileReader" path="/var/prio1" /> ...... </service> <service name="Priority2"> <file:inbound-endpoint ref="fileReader" path="/var/prio2" /> ...... </service> </model> |
1.4.2 <inbound-endpoint>
这是服务组件接收事件的通道,它包括使用的传输器,地址,路径或资源(任何有效的URI):
<inbound-endpoint address="udp://localhost:65432" /> <inbound-endpoint address="jms://test.queue" /> |
1.4.3 <outbound-endpoint>
这个是组件返回的数据被发送出去的通道;
<outbound-endpoint address="smtp://user:secret@smtp.host" /> <outbound-endpoint address="smtp://user:secret@smtp.host" /> |