Camel Usage Japanese - acromusashi/acromusashi-stream-example GitHub Wiki
本ページではCamelを用いたイベントルーティングプロセスの利用方法について説明します。
HttpPostの要素としてJSONを受信し、Kestrelに投入を行うルーティングプロセスです。
起動方法/設定方法は下記の通りです。
wget https://github.com/downloads/acromusashi/acromusashi-stream-example/acromusashi-stream-example-camel-1.0.0.zip
unzip acromusashi-stream-example-camel-1.0.0.zip
cd camel
vi conf/camel-context-example-json_kestrel.xml
設定内容
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- Set Host for CamelProcess -->
<from uri="jetty:http://__CAMEL_HOST__:8080/JSONReceive" /> ## HTTP待ち受けを行うホストを設定
<bean ref="JsonExtractor" method="extractJson" />
<!-- Set Kestrel Host -->
<to uri="kestrel://__KESTREL_HOST__/JSONQueue" /> ## Kestrelが動作しているホストを設定
</route>
</camelContext>
chmod +x bin/startCamelJson2Kestrel.sh
bin/startCamelJson2Kestrel.sh
SNMP Trapを受信し、JSONに変換してKestrelに投入を行うルーティングプロセスです。
起動方法/設定方法は下記の通りです。
wget https://github.com/downloads/acromusashi/acromusashi-stream-example/acromusashi-stream-example-camel-1.0.0.zip
unzip acromusashi-stream-example-camel-1.0.0.zip
cd camel
vi conf/camel-context-example-snmp_kestrel.xml
設定内容
<camelContext xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
<xmljson id="xmljson" />
</dataFormats>
<route>
<!-- Set Host for CamelProcess -->
<from uri="snmp:__CAMEL_HOST__:162?type=TRAP" /> ## SNMPTrap待ち受けを行うホストを設定
<bean ref="parser" method="parseSNMP" />
<marshal ref="xmljson" />
<!-- Set Kestrel Host -->
<to uri="kestrel://__KESTREL_HOST__/MessageQueue" /> ## Kestrelが動作しているホストを設定
</route>
</camelContext>
chmod +x bin/startCamelSnmp2Kestrel.sh
bin/startCamelSnmp2Kestrel.sh