一个简单的场景,做下笔记:
典型的In-Out接口: cxf-bc(consumer) –> eip “Static Routing Slip” –> saxon –> cxf-bc(provider)
CXF配置
<beans xmlns=“http://www.springframework.org/schema/beans”
xmlns:cxfbc=“http://servicemix.apache.org/cxfbc/1.0”
xmlns:xsi=“http://http://www.w3.org/2001/XMLSchema-instance”
xmlns:novaesb=“http://www.hongcheng.com/novaesb/selectnumber”
xmlns:clarity=“http://webservices/clarity/api/numbermanagement”
xsi:schemaLocation=“http://servicemix.apache.org/cxfbc/1.0 http://servicemix.apache.org/schema/servicemix-cxf-bc-3.2.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd”>
<bean id=“propertyConfigurer”
class=“org.springframework.beans.factory.config.PropertyPlaceholderConfigurer”>
<property name=“location”>
<value>classpath:slt-npe-config.properties</value>
</property>
</bean>
<cxfbc:consumer wsdl=“classpath:SelectNumber.wsdl”
service=“novaesb:SelectNumberServer”
endpoint=“SelectNumberPort”
locationURI=“${novaesb.selectnumber.url}”
targetService=“novaesb:routingSlip”
targetEndpoint=“endpoint”
useJBIWrapper=“false”/>
<cxfbc:provider wsdl=“classpath:NumberManagementAPIService.wsdl”
service=“clarity:NumberManagementAPIService”
endpoint=“NumberManagementAPIPort”
useJBIWrapper=“false”/>
</beans>
EIP配置
<beans xmlns:eip=“http://servicemix.apache.org/eip/1.0”
xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://http://www.w3.org/2001/XMLSchema-instance”
xmlns:novaesb=“http://www.hongcheng.com/novaesb/selectnumber”
xmlns:clarity=“http://webservices/clarity/api/numbermanagement”
xsi:schemaLocation=“http://servicemix.apache.org/eip/1.0 http://servicemix.apache.org/schema/servicemix-eip-3.2.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd”>
<eip:static-routing-slip service=“novaesb:routingSlip” endpoint=“endpoint”>
<eip:targets>
<eip:exchange-target service=“novaesb:xslt” endpoint=“endpoint”/>
<eip:exchange-target service=“clarity:NumberManagementAPIService” endpoint=“NumberManagementAPIPort” operation=“clarity:getNumbersViaAreaHierarchy”/>
</eip:targets>
</eip:static-routing-slip>
</beans>
XSLT
<xsl:stylesheet version=‘1.0’
xmlns:xsl=‘http://www.w3.org/1999/XSL/Transform’
xmlns:novaesb=“http://www.hongcheng.com/novaesb/selectnumber”
xmlns:clarity=“http://webservices/clarity/api/numbermanagement”>
<xsl:namespace-alias stylesheet-prefix=“novaesb” result-prefix=“clarity”/>
<xsl:output method=“xml” indent=“yes” encoding=“UTF-8”/>
<xsl:template match=“//novaesb:getNumbersViaAreaHierarchy”>
<clarity:getNumbersViaAreaHierarchy>
<ServiceType><xsl:value-of select=“novaesb:ProductName”/></ServiceType>
<NumberType><xsl:value-of select=“novaesb:CustomerLevel”/></NumberType>
<Area><xsl:value-of select=“novaesb:Area”/></Area>
<CityCode><xsl:value-of select=“novaesb:CityCode”/></CityCode>
<NumberStatus><xsl:value-of select=“novaesb:NumberStatus”/></NumberStatus>
<HowMany><xsl:value-of select=“novaesb:HowMany”/></HowMany>
<NumberPattern><xsl:value-of select=“novaesb:NumberPattern”/></NumberPattern>
<ConsecutiveFlag><xsl:value-of select=“novaesb:ConsecutiveFlag”/></ConsecutiveFlag>
</clarity:getNumbersViaAreaHierarchy>
</xsl:template>
</xsl:stylesheet>
可以看到,这里我去掉了JBI的包装,而采用了SOAP的包装,这里是无所谓的.个人建议采用SOAP包装.
@zuowangxi关于EIP我想没什么特别的,可以参考神作《Enterprise Integration Patterns》 不知道你说的原理是指什么,如果只是配置原理,这本书上写的远远比Servicemix EIP组件多的多,可以参考Apache camel这个EIP.
你好,你的eip配置,只写了static-routing-slip 这种方式的配置,还有其他的配置比如 那个的配置怎么写呢?我试过结果出来是正确的,但是不知道原理,能否解释下?谢谢了!我邮箱525620807@qq.com
就eip而言,还有
Content-Based Router
Message Filter
Pipeline
Static Recipient List
等方式,这些的配置及原理是什么呢?