`

Mule开发知识汇总(一)

阅读更多

        Mule是一个以Java为核心的轻量级的消息框架和整合平台,基于EIP(Enterprise Integeration Patterns,由Hohpe和Woolf编写的一本书)而实现的。Mule更关注其灵活性,高效性以及易开发性,在开源的ESB领域可谓一枝独秀。

 

    当前Mule的版本分为商业版和社区版两个版本,其中社区版作为开源发布。在功能的区分上,商业版支持更多的功能,其中就包括分布式部署。而且商业版提供自带的监控和管理平台,可以帮助开发这快速完成应用部署、平台监控等功能。

 

    在开发方式上,Mule开发方式分为两种,FLOW方式和Configuration Patterns方式。FLOWS标签更具有开发弹性,为可视化的开发提供可能,PATTERNS模式提供了具体的集成特性。

 

    下面列举几个简单的用Mule Studio开发工具的开发示例:

    1、Web Service代理发布,MULE直接充当第三方发布的Web Service接口的网关/代理。

        以FLOW方式发布: 

<flow name="HttpProxyService">
      <http:inbound-endpoint keep-alive="false" address="http://localhost:8888" exchange-pattern="request-response"/>
      <http:outbound-endpoint method="GET" keep-alive="false" address="http://webservice.webxml.com.cn#[header:INBOUND:http.request]" exchange-pattern="request-response"/>
</flow>

         注意红色字符串,#[header:INBOUND:http.request],设置需要访问的地址。method="GET"性,必须显示的设置,否则服务无法访问。

         以Configuration Patterns方式发布: 

<pattern:web-service-proxy name="ws-proxy" inboundAddress="http://localhost:8887/zjhz/webService"   	outboundAddress="http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl">
</pattern:web-service-proxy>

     2、通过MULE发布HTTP代理方式,类似发布WEB SERVICE代理

<flow name="HttpProxyService">
      <http:inbound-endpoint keep-alive="false" address="http://localhost:8888" exchange-pattern="request-response"/>
      <http:outbound-endpoint method="GET" keep-alive="false" address="http://localhost:7070#[header:INBOUND:http.request]" exchange-pattern="request-response"/>
</flow>

    其中,inbound-endpoint为对外发布的接口。outbound-endpoint为第三方提供的HTTP服务接口地址。

    更多的例子,以后陆续更新。陆续还会增加关于源码的下载、Mule项目搭建和源码的分析等内容。

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics