- 浏览: 289400 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (133)
- boss好文 (10)
- 数据模型 (2)
- together (1)
- oracle (10)
- 健康生活 (4)
- js好东东 (8)
- 工作流 (1)
- 常见java问题 (7)
- BOSS开发随想 (0)
- rose相关 (1)
- 股市看图 (4)
- java基础 (12)
- jbpm (1)
- 集群(负载均衡) (4)
- spring教程 (2)
- maven入门 (5)
- 项目管理 (14)
- 常用软件 (3)
- mysql (4)
- j2ee性能调优 (2)
- jfreechart相关 (1)
- 需求工具 (2)
- maven基础讲解 (3)
- AXURE下载 (2)
- db2 (2)
- svn (1)
- 日常操作技巧 (3)
- SOA (16)
- jetty (2)
- jetspeed (0)
- camel (0)
- 安卓开发 (4)
- ESB (4)
- 物流 (2)
- 软件需求的3个层次 (1)
- WMS (1)
- eclipse (1)
- 安卓源代码 (2)
- jar (0)
最新评论
-
seeYourEye:
prt1979 写道怎么在点“open project”后,选 ...
PL/SQL Developer插件之SVN -
prt1979:
怎么在点“open project”后,选择文件夹后一直弹出“ ...
PL/SQL Developer插件之SVN -
houlianxue:
LateCHI 写道东西不错。可以正常打开目录。但是进行svn ...
PL/SQL Developer插件之SVN -
LateCHI:
东西不错。可以正常打开目录。但是进行svn操作的时候提示 un ...
PL/SQL Developer插件之SVN -
w.tany:
很多地方少个# 号
<s:property>的用法
1 Mule-config.xml
示例模型:
<mule>
<model>
<service name="GreeterUMO">
<inbound....>
<filtering-router>
....
</filtering-router>
</inbound>
<component.... />
<outbound....>
.......
</outbound>
<default-service-exception-strategy>
.....
</default-service-exception-strategy>
</service>
<service name="GreeterUMO2" initialState="stopped">
...
</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、消息的路由信息将其发送到下一个服务组件。
1.3 声明服务组件
1.3.1 <component>
Mule组件是通过指定实施类名配置的,Mule为组件接收的每个消息创建新的类实例,注意是一个特定的Java类而不是函数:
<component class="org.my.ServiceComponentImpl" />
1.3.2 <pooled-component>
Mule创建一批组件,共用组件配置,对象工厂创建一个单一的对象实例也可以指定:
<pooled-component class="org.my.ServiceComponentImpl" />
<component>
<singleton-object class="org.my.ServiceComponentImpl" />
</component>
1.3.3 <entry-point-resolver-set/>
Mule可以创建一个入口点分解器基于消息负载情况动态选择调用的函数:
<component class="org.my.PrototypeObjectWithMyLifecycle">
<entry-point-resolver-set>
<array-entry-point-resolver />
<callable-entry-point-resolver />
</entry-point-resolver-set>
</component>
1.3.4 <callable-entry-point-resolver>
这个入口点分解器用于组件实现org.mule.api.lifecycle.Callable接口,组件可以实现Callable接口废除一切动态解决方案,并调用接口函数进行替代;
1.3.5 <custom-entry-point-resolver-set>
这个自定义入口点分解器可以和实现了org.mule.api.model.EntryPointResolverSet接口的类一起实施,为了准确地在你的端点上指定函数,你可以在端点上使用函数参数,如:
<ejb:endpoint host="localhost" port="1099" object="SomeService"
method="remoteMethod" />
1.3.6 <log-component/>
Mule提供了多个简单有用的组件用于测试和初始化原型,如<log-component/>,它将所有接收到的消息输出到控制台中;
1.4 配置端点
1.4.1 <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" />
1.5 配置入站路由
1.5.1 <selective-consumer-router>
这个路由在入站消息上应用一个或多个过滤器,符合要求的消息被转送到组件:
<inbound>
<selective-consumer-router>
<mulexml:jxpath-filter expression="msg/header/resultcode = 'success'" />
</selective-consumer-router>
<forwarding-catch-all-strategy>
<jms:endpoint topic="error.topic" />
</forwarding-catch-all-strategy>
</inbound>
1.5.2 <idempotent-receiver-router>
这个路由通过检查入站消息的唯一性消息ID确保服务接收的消息是唯一性的,ID可以使用idExpression属性中定义的表达式生成:
<inbound>
<secure-hash-idempotent-receiver-router
messageDigestAlgorithm="SHA26">
<simple-text-file-store directory="./idempotent" />
</secure-hash-idempotent-receiver-router>
</inbound>
1.5.3 <secure-hash-idempotent-receiver>
这个路由通过计算消息内容的散列值确保服务接收到的消息的唯一性:
<inbound>
<secure-hash-idempotent-receiver-router
messageDigestAlgorithm="SHA26">
<simple-text-file-store directory="./idempotent" />
</secure-hash-idempotent-receiver-router>
</inbound>
1.6 配置出站路由
1.6.1 <filtering-router>
这个路由使用过滤器确定消息是否匹配特定的标准;
<outbound matchAll="true">
<filtering-router>
<endpoint address="jms://deposit.queue" />
</filtering-router>
<filtering-router>
<jms:outbound-endpoint queue="large.deposit.queue" />
<mulexml:jxpath-filter expression="deposit/amount >= 100000" />
</filtering-router>
</outbound>
1.6.2 <pass-through-router>
这个路由匹配所有的消息,通过一个配置好的端点发送出去;
<outbound>
<pass-through-router>
<smtp:outbound-endpoint to="ross@muleumo.org" />
</pass-through-router>
</outbound>
1.6.3 <static-recipient-list-router>
这个路由用于从单个端点发送相同的消息到多个端点,或实施消息属性或有效负载确定的下一个目的地的路由滑动行为;
<outbound>
<static-recipient-list-router>
<payload-type-filter expectedType="javax.jms.Message" />
<recipients>
<spring:value>jms://orders.queue</spring:value>
<spring:value>jms://tracking.queue</spring:value>
</recipients>
</static-recipient-list-router>
</outbound>
1.7 配置传输器和连接器
以为传输器声明一个描述连接信息的端点URI的值:
<rmi:endpoint name="BadType" host="localhost" port="1099"
object="MatchingUMO" method="reverseString" />
<jms:inbound-endpoint queue="test.queue" />
<ssl:endpoint name="clientEndpoint" host="localhost" port="60198"
synchronous="true" />
<quartz:endpoint name="qEP6" repeatCount="10"
repeatInterval="1000" jobName="job" />
同样,可以使用<connector>元素定义一个连接器配置,Mule使用标准的组件,如Work Manager高效共享线程资源,并为线程使用提供更多控制,对于错误,你也要象事务行为一样声明一个异常策略:
<vm:connector name="VMConnector">
...
<default-connector-exception-strategy>
<vm:outbound-endpoint path="systemErrorHandler" />
</default-connector-exception-strategy>
</vm:connector>
1.8 配置转换器
可以配置一个本地或全局的转换器,本地转换器定义在端点上,而全局转换器是在需要的时候进行引用的,下面的代码定义了两个全局转换器:
<xm:xml-to-object-transformer name="XMLToExceptionBean"
returnClass="org.mule.example.errorhandler.ExceptionBean" />
<custom-transformer name="ExceptionBeanToErrorMessage"
class="org.mule.example.errorhandler.ExceptionBeanToErrorMessage"
returnClass="org.mule.example.errorhandler.ErrorMessage" />
1.8.1 <append-string-transformer>
在现有的字符串上追加了一个字符串:
<append-string-transformer name="myAppender"
message=" ... that's good to know!" />
1.8.2 <xslt-transformer>
通过XSLT处理XML负载:
<mulexml:xslt-transformer name="xslt"
xslFile="./conf/xsl/cd-listing.xsl">
<mulexml:context-property key="title"
value="#[header:ListTitle]" />
<mulexml:context-property key="rating"
value="#[header:ListRating]" />
</mulexml:xslt-transformer>
示例模型:
<mule>
<model>
<service name="GreeterUMO">
<inbound....>
<filtering-router>
....
</filtering-router>
</inbound>
<component.... />
<outbound....>
.......
</outbound>
<default-service-exception-strategy>
.....
</default-service-exception-strategy>
</service>
<service name="GreeterUMO2" initialState="stopped">
...
</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、消息的路由信息将其发送到下一个服务组件。
1.3 声明服务组件
1.3.1 <component>
Mule组件是通过指定实施类名配置的,Mule为组件接收的每个消息创建新的类实例,注意是一个特定的Java类而不是函数:
<component class="org.my.ServiceComponentImpl" />
1.3.2 <pooled-component>
Mule创建一批组件,共用组件配置,对象工厂创建一个单一的对象实例也可以指定:
<pooled-component class="org.my.ServiceComponentImpl" />
<component>
<singleton-object class="org.my.ServiceComponentImpl" />
</component>
1.3.3 <entry-point-resolver-set/>
Mule可以创建一个入口点分解器基于消息负载情况动态选择调用的函数:
<component class="org.my.PrototypeObjectWithMyLifecycle">
<entry-point-resolver-set>
<array-entry-point-resolver />
<callable-entry-point-resolver />
</entry-point-resolver-set>
</component>
1.3.4 <callable-entry-point-resolver>
这个入口点分解器用于组件实现org.mule.api.lifecycle.Callable接口,组件可以实现Callable接口废除一切动态解决方案,并调用接口函数进行替代;
1.3.5 <custom-entry-point-resolver-set>
这个自定义入口点分解器可以和实现了org.mule.api.model.EntryPointResolverSet接口的类一起实施,为了准确地在你的端点上指定函数,你可以在端点上使用函数参数,如:
<ejb:endpoint host="localhost" port="1099" object="SomeService"
method="remoteMethod" />
1.3.6 <log-component/>
Mule提供了多个简单有用的组件用于测试和初始化原型,如<log-component/>,它将所有接收到的消息输出到控制台中;
1.4 配置端点
1.4.1 <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" />
1.5 配置入站路由
1.5.1 <selective-consumer-router>
这个路由在入站消息上应用一个或多个过滤器,符合要求的消息被转送到组件:
<inbound>
<selective-consumer-router>
<mulexml:jxpath-filter expression="msg/header/resultcode = 'success'" />
</selective-consumer-router>
<forwarding-catch-all-strategy>
<jms:endpoint topic="error.topic" />
</forwarding-catch-all-strategy>
</inbound>
1.5.2 <idempotent-receiver-router>
这个路由通过检查入站消息的唯一性消息ID确保服务接收的消息是唯一性的,ID可以使用idExpression属性中定义的表达式生成:
<inbound>
<secure-hash-idempotent-receiver-router
messageDigestAlgorithm="SHA26">
<simple-text-file-store directory="./idempotent" />
</secure-hash-idempotent-receiver-router>
</inbound>
1.5.3 <secure-hash-idempotent-receiver>
这个路由通过计算消息内容的散列值确保服务接收到的消息的唯一性:
<inbound>
<secure-hash-idempotent-receiver-router
messageDigestAlgorithm="SHA26">
<simple-text-file-store directory="./idempotent" />
</secure-hash-idempotent-receiver-router>
</inbound>
1.6 配置出站路由
1.6.1 <filtering-router>
这个路由使用过滤器确定消息是否匹配特定的标准;
<outbound matchAll="true">
<filtering-router>
<endpoint address="jms://deposit.queue" />
</filtering-router>
<filtering-router>
<jms:outbound-endpoint queue="large.deposit.queue" />
<mulexml:jxpath-filter expression="deposit/amount >= 100000" />
</filtering-router>
</outbound>
1.6.2 <pass-through-router>
这个路由匹配所有的消息,通过一个配置好的端点发送出去;
<outbound>
<pass-through-router>
<smtp:outbound-endpoint to="ross@muleumo.org" />
</pass-through-router>
</outbound>
1.6.3 <static-recipient-list-router>
这个路由用于从单个端点发送相同的消息到多个端点,或实施消息属性或有效负载确定的下一个目的地的路由滑动行为;
<outbound>
<static-recipient-list-router>
<payload-type-filter expectedType="javax.jms.Message" />
<recipients>
<spring:value>jms://orders.queue</spring:value>
<spring:value>jms://tracking.queue</spring:value>
</recipients>
</static-recipient-list-router>
</outbound>
1.7 配置传输器和连接器
以为传输器声明一个描述连接信息的端点URI的值:
<rmi:endpoint name="BadType" host="localhost" port="1099"
object="MatchingUMO" method="reverseString" />
<jms:inbound-endpoint queue="test.queue" />
<ssl:endpoint name="clientEndpoint" host="localhost" port="60198"
synchronous="true" />
<quartz:endpoint name="qEP6" repeatCount="10"
repeatInterval="1000" jobName="job" />
同样,可以使用<connector>元素定义一个连接器配置,Mule使用标准的组件,如Work Manager高效共享线程资源,并为线程使用提供更多控制,对于错误,你也要象事务行为一样声明一个异常策略:
<vm:connector name="VMConnector">
...
<default-connector-exception-strategy>
<vm:outbound-endpoint path="systemErrorHandler" />
</default-connector-exception-strategy>
</vm:connector>
1.8 配置转换器
可以配置一个本地或全局的转换器,本地转换器定义在端点上,而全局转换器是在需要的时候进行引用的,下面的代码定义了两个全局转换器:
<xm:xml-to-object-transformer name="XMLToExceptionBean"
returnClass="org.mule.example.errorhandler.ExceptionBean" />
<custom-transformer name="ExceptionBeanToErrorMessage"
class="org.mule.example.errorhandler.ExceptionBeanToErrorMessage"
returnClass="org.mule.example.errorhandler.ErrorMessage" />
1.8.1 <append-string-transformer>
在现有的字符串上追加了一个字符串:
<append-string-transformer name="myAppender"
message=" ... that's good to know!" />
1.8.2 <xslt-transformer>
通过XSLT处理XML负载:
<mulexml:xslt-transformer name="xslt"
xslFile="./conf/xsl/cd-listing.xsl">
<mulexml:context-property key="title"
value="#[header:ListTitle]" />
<mulexml:context-property key="rating"
value="#[header:ListRating]" />
</mulexml:xslt-transformer>
发表评论
-
BPEL或ESB:应该使用哪一个?
2012-03-13 17:09 1178在设计 SOA 解决方案时 ... -
ESB 案例解析和项目实施经验分享,第 3 部分: ESB 项目需求分析和方案设计浅谈
2012-02-15 14:50 1756选自:http://www.ibm.com/developer ... -
ESB 案例解析和项目实施经验分享,第 2 部分: 刚柔相济,构建企业联邦 ESB
2012-02-15 14:37 1827摘自:http://www.ibm.com/developer ... -
ESB案例分析:第 1 部分: 借助 ESB 整合航空公司商务体系,提升客户服务水平
2012-02-15 14:14 1891摘自:http://www.ibm.com/developer ... -
ESB架构之企业实施案例
2012-02-14 17:33 1385本文是摘抄自: http://www.webspherechi ... -
关于mule的网站
2011-11-07 10:17 1242关于mule的网站 1,http://note.sdo.com ... -
muleStudio发布到指定目录下
2011-11-04 15:14 1079在mule studio中右键项目名称,选择EXPORT,在弹 ... -
mule配置基础
2011-11-03 10:26 8780Mule是开源的企业集成消息框架,,它的配置需要使用大量的XM ... -
mule & seda 学习四
2011-11-03 09:10 952从前,从前 程序跑的太慢,对mule有点误解 jaxb解析 ... -
mule & seda的学习三
2011-11-03 09:10 1213以竣工服务为例 package com.tydic.mule ... -
mule & seda 学习二
2011-11-03 09:11 1165mule的jdbc,配置seda以及vm的初步认识 java ... -
mule & seda的学习之一
2011-11-02 17:18 1276mule:轻量级的ESB消息框架,可以和spring集成,支持 ... -
一个不错的MULE主文件
2011-11-02 17:06 1947mule & seda 的使用每分钟处理5000单,发 ... -
mule示例分析
2011-11-02 14:55 6967一、Hello World (主要演示了两个service c ... -
Mule 官方例子研究
2011-10-28 14:26 1865Mule 官方例子研究 一、 ...
相关推荐
mule基本节点解释汇总 <mule> .... ....... ..... ... </mule>
mule 3.2 节点详解 , 对mule 的端点、组件的属性有详细的描述
关于在tomcat上进行mule多线程数量参数配置
这个是mule esb 各个节点的说明文档,包括常用的文件类型,过滤器,消息队列等等信息,非常好的资源!
Mule ESB 是一个轻量级的基于java的企业服务总线和集成平台, 使得开发人员可以快速,简单的连接多个应用, 使得它们可以交换数据。 Mule ESB 容易集成现有异构系统,包括:JMS, Web Services, JDBC, HTTP, 等. ESB...
mule的配置文档 自己整理,很实用滴,希望大家可以和我一样少走歪路
Mule是一个企业服务总线(ESB)消息框架,而且Mule是一个轻量级且高度可扩展的ESB。
mule -esb 源码
mule,mule esb,Mule,ESB
mule in action 和doc文档详细介绍 Mule的核心组件是UMO(Universal Message Objects,从Mule2.0开始UMO这一概念已经被组件Componse所代替),UMO实现整合逻辑。UMO可以是POJO,JavaBean等等。它支持30多种传输协议...
Mule ESB应用部署 Mule ESB应用的目录结构,配置文件说明
mule入门文档 mule入门文档 mule入门文档mule入门文档
mule开发帮助文档,关于配置开发等等
Mule in Action, Second Edition is a totally-revised guide covering Mule 3 fundamentals and best practices. It starts with a quick ESB overview and then dives into rich examples covering core concepts ...
利用mule 服务总线代理 cxf发布的服务。其中详细的描述了cxf服务的发布的访问,以及如何使用mule的代理模式代理cxf的服务。步骤详细,有图有真相.