オープンソースのエンタープライズ・サービス・バスエンジンであるMule ESBをちょっといじってみようということで、ダウンロードしてサンプルアプリのエコーサーバを動かしてみました。
Downloadページから「Mule ESB standalone runtime」をダウンロード。
exportを追加。
12export
MULE_HOME=$HOME
/mule
export
PATH=$PATH:$MULE_HOME
/bin
とりあえず起動。
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859$
cd
~
/mule
$ mule
MULE_HOME is
set
to
/Users/safx/mule
Running
in
console (foreground) mode by default, use Ctrl-C to
exit
...
MULE_HOME is
set
to
/Users/safx/mule
Running Mule...
--> Wrapper Started as Console
Launching a JVM...
Starting the Mule Container...
Wrapper (Version 3.2.3) http:
//wrapper
.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
WARNING - Unable to load the Wrapper's native library because none of the
following files:
libwrapper-macosx-x86-64.jnilib
libwrapper-macosx-universal-64.jnilib
libwrapper.jnilib
could be located on the following java.library.path:
/Users/safx/mule/
%LD_LIBRARY_PATH%
/Users/safx/mule/lib/boot
Please see the documentation
for
the wrapper.java.library.path
configuration property.
System signals will not be handled correctly.
INFO 2014-02-18 23:52:35,686 [WrapperListener_start_runner] org.mule.module.launcher.MuleContainer:
**********************************************************************
* Mule ESB and Integration Platform *
* Version: 3.4.0 Build: c8afb471 *
* MuleSoft, Inc. *
* For
more
information go to http:
//www
.mulesoft.org *
* *
* Server started: 2
/18/14
11:52 PM *
* JDK: 1.6.0_65 (mixed mode) *
* OS: Mac OS X (10.9.1, x86_64) *
* Host: Safxs-MacBook-Pro.
local
(192.168.0.5) *
**********************************************************************
INFO 2014-02-18 23:52:35,688 [WrapperListener_start_runner] org.mule.module.launcher.coreextension.DefaultMuleCoreExtensionManager: Initializing core extensions
INFO 2014-02-18 23:52:35,688 [WrapperListener_start_runner] org.mule.module.launcher.coreextension.DefaultMuleCoreExtensionManager: Starting core extensions
INFO 2014-02-18 23:52:35,715 [WrapperListener_start_runner] org.mule.module.launcher.application.DefaultMuleApplication:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ New app
'default'
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2014-02-18 23:52:38,127 [WrapperListener_start_runner] org.mule.module.launcher.MuleDeploymentService:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app
'default'
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2014-02-18 23:52:38,129 [WrapperListener_start_runner] org.mule.module.launcher.StartupSummaryDeploymentListener:
**********************************************************************
* - - + APPLICATION + - - * - - + STATUS + - - *
**********************************************************************
* default * DEPLOYED *
**********************************************************************
INFO 2014-02-18 23:52:38,133 [WrapperListener_start_runner] org.mule.module.launcher.MuleDeploymentService:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Mule is up and kicking (every 5000ms) +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$MULE_HOME/examples/echoにあるmule-example-echo–3.x.y.zipを$MULE_HOME/appにコピーします。muleは5秒おきにappフォルダを監視していて、新しいzipが入れられると自動でデプロイするみたいです。
123456789INFO 2014-02-19 00:01:40,479 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.DefaultMuleDeployer: Exploding a Mule application archive:
file
:
/Users/safx/mule/apps/mule-example-echo-3
.4.0.zip
INFO 2014-02-19 00:01:40,485 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.application.DefaultMuleApplication:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ New app
'mule-example-echo-3.4.0'
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2014-02-19 00:01:40,856 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.MuleDeploymentService:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app
'mule-example-echo-3.4.0'
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
とりあえず、これでhttp://localhost:8084/foobarにアクセスすると、次のような結果が得られます。もちろんfoobarの部分を変えると、表示内容も変わります。
Ctrl-cで終了します。
ソースコード
echoサンプルには、ソースコードというかフロー制御を記述したXMLがあるだけみたいです。
そのコードを一部抜粋したのがこちらになります。
1 2 3 4 5 6 7 | <flow name="EchoFlow" doc:name="EchoFlow"> <http:inbound-endpoint host="localhost" port="8084" doc:name="HTTP" doc:description="Process HTTP requests or responses." exchange-pattern="request-response"/> <logger message="About to echo #[message:payload]" level="INFO" doc:name="Logger"/> <echo-component doc:name="Echo"/> </flow> |
ちょっとわかりづらいですが、入力をローカルホストのポート8084のHTTPとして、それをEchoコンポーネントに繋げる、というFlowをひとつ定義しているようです。
おわりに
Mule ESBを導入して、サンプルアプリを動かしてみました。
利用できるのか確認していませんが、いろいろな外部連携もできるみたいです。
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。