Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Devclub Servicemix Jevgeni Holodkov 23 04 09

1,259 views

Published on

  • Be the first to comment

  • Be the first to like this

Devclub Servicemix Jevgeni Holodkov 23 04 09

  1. 1. Servicemix 3.х Сервисная шина ESB Евгений Холодков devclub.eu 23.04.09
  2. 2. Servicemix глазами клиентов
  3. 3. Servicemix глазами архитектора
  4. 4. Java Business Integration (JBI)
  5. 5. Servicemix глазами разработчика • XML • Java <beans xmlns:jms=quot;http://servicemix.apache.org/jms/1.0quot; public class InsuranceJMSMarshaler extends DefaultConsumerMarshaler { xmlns:esb=quot;http://esbinaction.com/insurancequot;> <classpath> protected void populateMessage(Message message, <location>.</location> NormalizedMessage normalizedMessage) throws Exception { ...... if (message instanceof ObjectMessage) { <location>wstx-asl.jar</location> ObjectMessage objectMessage = (ObjectMessage) message; <location>xpp3.jar</location> Object payload = objectMessage.getObject(); </classpath> Source source = JiBXUtil.marshalDocument(payload, quot;UTF-8quot;); <jms:consumer service=quot;esb:insuranceReceiverquot; normalizedMessage.setContent(source); endpoint=quot;jmsEndpoint“ targetService=quot;esb:insuranceDSLRouterquot; } else { destinationName=quot;insurance.in“ throw new UnsupportedOperationException(quot;JMS message is not a connectionFactory=quot;#connectionFactoryquot; ObjectMessagequot;); marshaler=quot;#InsuranceJMSMarshalerquot;/> } <bean id=quot;InsuranceJMSMarshalerquot; } class=quot;esb.dzone.servicemix.util.InsuranceJMSMarshalerquot;/> } <bean id=quot;connectionFactoryquot; class=quot;org.apache.activemq.ActiveMQConnectionFactoryquot;> <property name=quot;brokerURLquot; value=quot;tcp://localhost:61616quot; /> </bean> </beans>
  6. 6. Mvn генерирует/управляет кодом mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-http-provider-service-unit -DgroupId=org.apache.servicemix.samples -DartifactId=servicemix-example
  7. 7. Бизнес-процесс (1/2)
  8. 8. Бизнес-процесс (2/2)
  9. 9. Процесс в servicemix-e
  10. 10. Еще один пример
  11. 11. Servicemix-http компонент Consumer Provider <http:endpoint <http:endpoint service=quot;test:MyProviderServicequot; service=quot;test:MyConsumerServicequot; endpoint=quot;myProviderquot; targetService=quot;test:MyServiceRoutin role=quot;providerquot; gSlipquot; locationURI=quot;http://localhost:8080/ endpoint=quot;myConsumer“ MyServicequot; role=quot;consumerquot; soapVersion=quot;1.1quot; /> locationURI=quot;http://localhost:8192/S ervice/quot; defaultMep=quot;http://www.w3.org/20 04/08/wsdl/in-outquot; soapVersion=quot;1.1quot; wsdlResource=quot;classpath:MyService. wsdlquot; />
  12. 12. Servicemix-saxon компонент <beans xmlns:saxon=quot;http://servicemix.apache.org/saxon/1.0quot; xmlns:test=quot;http://www.mycompany.com/1.0quot;> <saxon:xslt service=quot;test:myTransformquot; endpoint=quot;myEndpointquot; resource=quot;classpath:transform.xslquot; /> </beans>
  13. 13. Servicemix-EIP компонент • Content-Based Router • Message Filter • Pipeline • Static Recipient List • Static Routing Slip • Wire Tap • XPath Splitter • Aggregator • Content Enricher • Resequencer • AsyncBridge
  14. 14. Паттерн content-based routing <eip:content-based-router service=quot;test:routerquot; endpoint=quot;endpointquot;> <eip:rules> <eip:routing-rule> <eip:predicate> <eip:xpath-predicate xpath=quot;count(/test:echo) = 1quot; namespaceContext=quot;#nsContextquot; /> </eip:predicate> <eip:target> <eip:exchange-target uri=quot;endpoint:http://test/pipeline/endpointquot; /> </eip:target> </eip:routing-rule> <eip:routing-rule> <!-- there is no predicate, so this is the default destination --> <eip:target> <eip:exchange-target service=quot;test:recipientsquot; /> </eip:target> </eip:routing-rule> </eip:rules> </eip:content-based-router>
  15. 15. Паттерн routing-slip <eip:static-routing-slip service=quot;test:routingSlipquot; endpoint=quot;endpointquot;> <eip:targets> <eip:exchange-target service=quot;test:transformRequestquot; /> <eip:exchange-target service=quot;test:myProviderquot; /> <eip:exchange-target service=quot;test: transformResponsequot; /> </eip:targets> </eip:static-routing-slip>
  16. 16. Servicemix-camel компонент <!-- the JBI container --> <sm:container id=quot;jbiContainerquot; embedded=quot;truequot;> <sm:components> <ref id=quot;jbiquot; /> </sm:components> <sm:endpoints> <bean:endpoint service=quot;myproject:trackerquot; endpoint=quot;trackerquot; bean=quot;#trackerquot; /> </sm:endpoints> </sm:container> <bean id=quot;jbiquot; class=quot;org.apache.servicemix.camel.CamelJbiComponentquot; /> <camelContext id=quot;camelContextquot; useJmx=quot;truequot; xmlns=quot;http://activemq.apache.org/camel/schema/springquot;> <package>my.project.routeBuilders</package> </camelContext>
  17. 17. Интеграционное тестирование • Wire Tap • SoapUI
  18. 18. Развертывание • SA = jar файл • Standalone vs web application
  19. 19. Итог • Активно развивающийся ESB с открытым кодом • Использует модульную JBI архитектуру • Активно использует Maven 2 • Интегрирован со Spring-ом • Содержит много готовых компонентов

×