Top Banner
Servicemix 3.х Сервисная шина ESB Евгений Холодков devclub.eu 23.04.09
19

Devclub Servicemix Jevgeni Holodkov 23 04 09

Jan 25, 2015

Download

Documents

helggeist

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Devclub Servicemix Jevgeni Holodkov 23 04 09

Servicemix 3.хСервисная шина ESB

Евгений Холодков devclub.eu 23.04.09

Page 2: Devclub Servicemix Jevgeni Holodkov 23 04 09

Servicemix глазами клиентов

Page 3: Devclub Servicemix Jevgeni Holodkov 23 04 09

Servicemix глазами архитектора

Page 4: Devclub Servicemix Jevgeni Holodkov 23 04 09

Java Business Integration (JBI)

Page 5: Devclub Servicemix Jevgeni Holodkov 23 04 09

Servicemix глазами разработчика

• XML<beans xmlns:jms="http://servicemix.apache.org/jms/1.0" xmlns:esb="http://esbinaction.com/insurance"> <classpath> <location>.</location> ...... <location>wstx-asl.jar</location> <location>xpp3.jar</location> </classpath> <jms:consumer service="esb:insuranceReceiver" endpoint="jmsEndpoint“ targetService="esb:insuranceDSLRouter" destinationName="insurance.in“

connectionFactory="#connectionFactory" marshaler="#InsuranceJMSMarshaler"/> <bean id="InsuranceJMSMarshaler" class="esb.dzone.servicemix.util.InsuranceJMSMarshaler"/> <bean id="connectionFactory"

class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://localhost:61616" /> </bean></beans>

• Javapublic class InsuranceJMSMarshaler extends DefaultConsumerMarshaler {

protected void populateMessage(Message message, NormalizedMessage normalizedMessage) throws Exception { if (message instanceof ObjectMessage) { ObjectMessage objectMessage = (ObjectMessage) message; Object payload = objectMessage.getObject(); Source source = JiBXUtil.marshalDocument(payload, "UTF-8"); normalizedMessage.setContent(source); } else { throw new UnsupportedOperationException("JMS message is not a

ObjectMessage"); } }}

Page 6: Devclub Servicemix Jevgeni Holodkov 23 04 09

Mvn генерирует/управляет кодом

mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-http-provider-service-unit -DgroupId=org.apache.servicemix.samples -DartifactId=servicemix-example

Page 7: Devclub Servicemix Jevgeni Holodkov 23 04 09

Бизнес-процесс (1/2)

Page 8: Devclub Servicemix Jevgeni Holodkov 23 04 09

Бизнес-процесс (2/2)

Page 9: Devclub Servicemix Jevgeni Holodkov 23 04 09

Процесс в servicemix-e

Page 10: Devclub Servicemix Jevgeni Holodkov 23 04 09

Еще один пример

Page 11: Devclub Servicemix Jevgeni Holodkov 23 04 09

Servicemix-http компонент

Consumer<http:endpoint service="test:MyConsumerService"

targetService="test:MyServiceRoutingSlip"

endpoint="myConsumer“ role="consumer"

locationURI="http://localhost:8192/Service/" defaultMep="http://www.w3.org/2004/08/wsdl/in-out" soapVersion="1.1" wsdlResource="classpath:MyService.wsdl" />

Provider<http:endpoint

service="test:MyProviderService" endpoint="myProvider" role="provider" locationURI="http://localhost:8080/MyService"

soapVersion="1.1" />

Page 12: Devclub Servicemix Jevgeni Holodkov 23 04 09

Servicemix-saxon компонент

<beans xmlns:saxon="http://servicemix.apache.org/saxon/1.0" xmlns:test="http://www.mycompany.com/1.0"> <saxon:xslt service="test:myTransform" endpoint="myEndpoint" resource="classpath:transform.xsl" />

</beans>

Page 13: Devclub Servicemix Jevgeni Holodkov 23 04 09

Servicemix-EIP компонент

• Content-Based Router• Message Filter• Pipeline• Static Recipient List• Static Routing Slip• Wire Tap• XPath Splitter• Aggregator• Content Enricher• Resequencer• AsyncBridge

Page 14: Devclub Servicemix Jevgeni Holodkov 23 04 09

Паттерн content-based routing<eip:content-based-router service="test:router" endpoint="endpoint"> <eip:rules> <eip:routing-rule> <eip:predicate> <eip:xpath-predicate xpath="count(/test:echo) = 1"

namespaceContext="#nsContext" /> </eip:predicate> <eip:target> <eip:exchange-target uri="endpoint:http://test/pipeline/endpoint" /> </eip:target> </eip:routing-rule> <eip:routing-rule> <!-- there is no predicate, so this is the default destination --> <eip:target> <eip:exchange-target service="test:recipients" /> </eip:target> </eip:routing-rule> </eip:rules></eip:content-based-router>

Page 15: Devclub Servicemix Jevgeni Holodkov 23 04 09

Паттерн routing-slip

<eip:static-routing-slip service="test:routingSlip" endpoint="endpoint"> <eip:targets> <eip:exchange-target service="test:transformRequest" /> <eip:exchange-target service="test:myProvider" /> <eip:exchange-target service="test: transformResponse" /> </eip:targets></eip:static-routing-slip>

Page 16: Devclub Servicemix Jevgeni Holodkov 23 04 09

Servicemix-camel компонент<!-- the JBI container --> <sm:container id="jbiContainer" embedded="true"> <sm:components> <ref id="jbi" /> </sm:components> <sm:endpoints> <bean:endpoint service="myproject:tracker" endpoint="tracker" bean="#tracker" /> </sm:endpoints> </sm:container>

<bean id="jbi" class="org.apache.servicemix.camel.CamelJbiComponent" />

<camelContext id="camelContext" useJmx="true" xmlns="http://activemq.apache.org/camel/schema/spring">

<package>my.project.routeBuilders</package> </camelContext>

Page 17: Devclub Servicemix Jevgeni Holodkov 23 04 09

Интеграционное тестирование

• Wire Tap

• SoapUI

Page 18: Devclub Servicemix Jevgeni Holodkov 23 04 09

Развертывание

• SA = jar файл• Standalone vs web application

Page 19: Devclub Servicemix Jevgeni Holodkov 23 04 09

Итог

• Активно развивающийся ESB с открытым кодом

• Использует модульную JBI архитектуру• Активно использует Maven 2• Интегрирован со Spring-ом• Содержит много готовых компонентов