阅读本文章以前建议先阅读《Apache ServiceMix 初探》
预备知识:
BluePrint
OSGI
Maven
Java DSL
Apache Camel
Apache ActiveMQ
ESB最核心的功能便是应用集成和服务路由,Apache ServiceMix完成这两大核心功能的尖兵利器便是Apache Camel。Apache Camel是一个开源的、功能丰富的应用集成框架,它支持常见的EIP模式,是一个强大的基于规则的路由引擎,可以轻松的实现消息路由和消息转换,ServiceMix对Camel进行了深度集成来支持各种复杂的ESB功能。
关于Apache Camel的介绍:
http://camel.apache.org/(主页)
http://marshal.easymorse.com/archives/1431
http://blog.csdn.net/njchenyi/article/details/5174261
关于EAI模式的介绍:
http://www.eaipatterns.com/toc.html
发布路由的4种方式
在ServiceMix上发布Camel Routes有两大类4种方式,所谓的两大类是指:其一,直接通过简单的xml配置文件发布;其二,通过自定义bundle的方式发布。而每类下面既可以通过Spring容器发布又可以通过BluePrint容器发布,所以说有4种方式。下面对这4种方式进行介绍,然后比较他们的优缺点。
1、基于blueprint容器,通过简单的Blueprint XML文档发布路由,发布方式及实验见《Apache ServiceMix 初探》
<?xml version="1.0" encoding="utf-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="file:camel/blueprin-plain-input"/>
<log message="Copying ${file:name} to the output directory"/>
<to uri="file:camel/blueprint-plain-output"/>
</route>
</camelContext>
</blueprint>