`
nanjingjiangbiao_T
  • 浏览: 2605929 次
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

mule 3 入门案例

 
阅读更多
转载请标明出处!~

最近想学习mule,打算从成功运行第一个例子开始。mule最新版本是mule-standalone-3.0.0,而网上很多安装入门的例子都是以前的版本,在配置xml时与以前版本不同,自己只好网上了解资料。
1.用Myeclipse 8.5在线安装插件mule:mule-standalone-3.0.0.zip版本。
更新链接:http://dist.muleforge.org/mule-ide/updates/3.4/

2.下载下载Mule 3.0.0:http://www.mulesoft.org/download-mule-esb-community-edition
并解压到某一工作目录如:D:\software\mule

3.添加骡子安装目录和选择默认的分布使用与骡子项目
Windows ->Preferences->mule->add->选择刚才解压的工作目录D:\software\mule,然后点击“OK”

4.结合网上有关例子:开发第一个Mule项目——Hello World
总体结构如:



5.创建接口
Java代码 收藏代码
  1. packagecom.mule.demo;
  2. publicinterfaceHello{
  3. publicStringhello(Stringname);
  4. }


5.创建实现类
Java代码 收藏代码
  1. packagecom.mule.demo;
  2. publicclassHelloImplimplementsHello{
  3. @Override
  4. publicStringhello(Stringname){
  5. //TODOAuto-generatedmethodstub
  6. returnname;
  7. }
  8. }


6.编写配置文件
在项目目录下创建conf文件夹,并创建文件:hello-config.xml。当然,你也可以从mule的例子中复制一个配置文件到此,mule 3.0与之前版本的配置不同,要做适当的修改。要想实现控制台输入信息,刚要配置链接stdio,红色部分。下面的本例子的配置:
Java代码 收藏代码
  1. <?xmlversion="1.0"encoding="UTF-8"?>
  2. <mulexmlns="http://www.mulesoft.org/schema/mule/core"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:spring="http://www.springframework.org/schema/beans"
  5. xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
  6. xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio"
  7. xsi:schemaLocation="
  8. http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  9. http://www.mulesoft.org/schema/mule/corehttp://www.mulesoft.org/schema/mule/core/3.0/mule.xsd
  10. http://www.mulesoft.org/schema/mule/cxfhttp://www.mulesoft.org/schema/mule/cxf/3.0/mule-cxf.xsd
  11. http://www.mulesoft.org/schema/mule/stdiohttp://www.mulesoft.org/schema/mule/stdio/3.0/mule-stdio.xsd"
  12. >
  13. <!--
  14. Thesystemstreamconnectorisusedtosendandreceiveinformationviathe
  15. System.inandSystem.out.Notethisconnectorisonlyreallyusefulfortesting
  16. purposes.
  17. promptMessage-iswhatiswrittentotheconsole
  18. messageDelayTime-isthetimeinmillisecondsbeforetheuserispromptedagain.
  19. Thesepropertiesaresetasbeanpropertiesontheconnector.
  20. -->
  21. <stdio:connectorname="SystemStreamConnector"
  22. promptMessage="Pleaseenteryoutname:"
  23. messageDelayTime="1000"/>
  24. <!--
  25. TheMulemodelinitialisesandmanagesyourUMOcomponents
  26. -->
  27. <modelname="HelloSample">
  28. <!--
  29. AMuleservicedefinesallthenecessaryinformationabouthowyourcomponentswill
  30. interactwiththeframework,othercomponentsinthesystemandexternalsources.
  31. PleaserefertotheConfigurationGuideforafulldescriptionofalltheparameters.
  32. -->
  33. <servicename="HelloUMO">
  34. <inbound>
  35. <stdio:inbound-endpointsystem="IN"/>
  36. </inbound>
  37. <componentclass="com.mule.demo.HelloImpl"/>
  38. <outbound>
  39. <pass-through-router>
  40. <stdio:outbound-endpointsystem="OUT"/>
  41. </pass-through-router>
  42. </outbound>
  43. </service>
  44. </model>
  45. </mule>


7.运行例子测试
右击hello-config.xml->run_configurations,则可看到运行效果。



来源:http://pj72021.iteye.com/blog/804956

ps:查找stdio的链接时发现mule3的例子网站:http://code.google.com/p/muleinaction/source/browse/branches/mule-3/chapter04/collection-aggregator/conf/collection-aggregator-config.xml?spec=svn479&r=479


分享到:
评论

相关推荐

    mule esb 项目 例子 入门

    mule esb 项目 例子 入门

    mule入门文档

    mule入门文档 mule入门文档 mule入门文档mule入门文档

    MULE ESB案例

    Mule ESB 项目在Linux中的部署与开发与应用案例

    Mule_入门、介绍及架构理解

    mule的强大不用多说。 Mule 入门、介绍及架构理解

    Mule3.4入门学习

    描述如何通过Mule实现Webservice的发布、实现JMS消息通信、ftp、File应用、协议转换等

    mule IDE (mule ESB)

    Mule ESB 是一个轻量级的基于java的企业服务总线和集成平台, 使得开发人员可以快速,简单的连接多个应用, 使得它们可以交换数据。 Mule ESB 容易集成现有异构系统,包括:JMS, Web Services, JDBC, HTTP, 等. ESB...

    mule standalone server 3

    mule standalone server 3

    mule ESB 3 user guider

    mule esb 3 user guider: 社区成熟,文档丰富的开源esb mule用户手册

    mule esb 3 tutorial.pdf

    This book provides a tutorial on how to develop Mule ESB 3 applications. It covers the essentials, such as using the Mule IDE, writing a configuration file, routing messages, and testing your ...

    mule(java)开发简介

    本文档是一个mule开发简介文档,属于mule入门级别,有使用者请下载

    mule文档详解 mule

    Mule是一个企业服务总线(ESB)消息框架,而且Mule是一个轻量级且高度可扩展的ESB。

    mule in action

    mule in action ,mule入门教程,系统学习资料,英文版

    Mule in Action, 2nd Edition

    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 入门文档

    在按照本文进行操作之前,假设您的系统已经具备以下前提: 已经安装了Sun公司的JDK1.4或JDK5.0版本,推荐使用JDK5.0。 正确设置了JAVA_HOME环境变量到JDK目录(注意不是JRE目录)。 确保%JAVA_HOME%\bin路径在系统...

    Mule入门文档

    NULL 博文链接:https://incan.iteye.com/blog/308428

    EIP经典案例ESB实践之Mule实现.rar_eip_esb_mule_mule esb

    EIP经典案例Load Broker————Mule ESB实践

    mule in action 说明+文档介绍

    mule in action 和doc文档详细介绍 Mule的核心组件是UMO(Universal Message Objects,从Mule2.0开始UMO这一概念已经被组件Componse所代替),UMO实现整合逻辑。...Mule 3版本以后集成OSGi,支持热部署。

Global site tag (gtag.js) - Google Analytics