linugb118--java space

Java

Mule ESB 实战

ESB

1.下载
http://www.mulesoft.org/documentation/display/MULE2INTRO/Home

下载Mule ESB 2.2.1 Full Dist.

2.zip 文件

3.安装所需要的环境
http://www.mulesoft.org/documentation/display/MULE2INTRO/Installing+Mule
java1.5+

Mule Build Tool有三种方式
Ant/Maven/Mule IDE
下面以Maven 为例进行操作

4.设置环境变量
比如

Linux/UNIX

export JAVA_HOME=/opt/java/jdk
export MAVEN_HOME=/opt/apache/maven-2.0.9
export MAVEN_OPTS='-Xmx512m -XX:MaxPermSize=256m'
export MULE_HOME=/opt/mule
export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$MULE_HOME/bin


Windows

set JAVA_HOME=C:\Program Files\Java\jdk
set MAVEN_HOME=C:\Apache\maven-2.0.9
set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=256m
set MULE_HOME=C:\Mule
set PATH=%PATH%;%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%MULE_HOME%\bin
   
Note: If you will run Mule as a Windows service, you must create system environment variables instead of user environment variables.

创建一个Maven repository 目录,比如c:\.m2\repository 在windows系统上,如果windows 不让创建.m2文件夹,请用mkdir目录创建
打开Maven conf 目录,比如c:\apache-maven-2.0.9\conf;打开setting.xml 文件,查找localRepository
将注释去除或者添加一段
<localRepository>c:/.m2/repository</localRepository>

5.run Hello Word
进入windows cmd 命令行,分别查看ant/maven是否正常

在%MULE_HOME%\lib\user 中查看是否存在mule-example-hello.jar
如果不存在 那么我们需要ant 或者 mvn 来build jar
我对mvn不是很熟悉,就用ant,在MULE_HOME%\examples下可以看到hello的例子
下面有build.xml 和pom.xml
查看build.xml 会发现,执行ant setup就能build hello project
在下来就要运行mule,hello文件夹下面的readme有描述

------------------
   Linux / Unix
    ------------
    mule -config file:conf/hello-config.xml
    mule -config file:conf/hello-http-config.xml
     or
    export MULE_LIB=./conf
    mule -config hello-config.xml
    mule -config hello-http-config.xml

    Windows
    -------
    mule.bat -config file:conf/hello-config.xml
    mule.bat -config file:conf/hello-http-config.xml
     or
    SET MULE_LIB=.\conf
    mule.bat -config hello-config.xml
    mule.bat -config hello-http-config.xml
   如果运行 http config那么通过
    http://localhost:8888/?name=Ross 可访问
 --------------------------------------------
 
 更方便的是例子下面提供了hello.bat 直接运行该bat 并输入1或者2为参数就能启动hello mule
 (需要提醒的是,第一次启动mule会有一大堆许可文件要你看,你输入任何键回车后多次过后你就能发现mule启动成功了)
 
 在conf下有hello-config.xml/hello-http-config.xml
 hello-config.xml他们在console端,通过system.in输入message,然后在system.out输出
 hello-http-config.xml 表示在浏览器中输入http://localhost:8888/?name=Ross 那么web页面会现在动态的name
 
6最简单构建Mule project
你可以通过安装Eclipse Mule IDE
http://www.mulesoft.org/documentation/display/MULE2INTRO/Quick+Start
或者Setting Up Eclipse for Use with Maven
http://www.mulesoft.org/documentation/display/MULE2INTRO/Setting+Up+Eclipse+for+Use+with+Maven

 

 
   


 

posted on 2010-08-11 13:55 linugb118 阅读(3805) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

My Links

Blog Stats

常用链接

留言簿(1)

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜