Apache Camel - WJax 2008
 

Apache Camel - WJax 2008

on

  • 3,444 views

 

Statistics

Views

Total Views
3,444
Views on SlideShare
3,426
Embed Views
18

Actions

Likes
2
Downloads
46
Comments
0

3 Embeds 18

http://inovex-de.heroku.com 11
http://www.slideshare.net 6
http://localhost 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Apache Camel - WJax 2008 Apache Camel - WJax 2008 Presentation Transcript

  • Leichtgewichtige Enterprise-Integration mit Apache Camel Christian Meder | inovex GmbH
  • Agenda
    • Warum Apache Camel ?
    • Enterprise Integration Patterns
    • Camel
      • Konzepte
      • DSL
      • Beispiel
      • Komponenten
      • Möglichkeiten
    • Fazit
  • Enterprise-Integration Enterprise Application Integration (EAI)‏ Service Oriented Architecture (SOA)‏ Webservices (WS-*)‏ Enterprise Service Bus (ESB)‏ Message Oriented Middleware (MOM)‏ XML SOAP WSDL HTTP Binärformate JMS
  • Nur für Spezialisten ?
  • Apache Camel
  • Das Buch Gregor Hohpe, Bobby Woolf Enterprise Integration Patterns “ The Bible for Enterprise Application Integration” (amazon.com)‏
  • Cast
  • Messaging
    • remove
    • location dependencies
    • data format dependencies
    • temporal dependencies
  • Enterprise Integration Patterns
    • 65 patterns
    • Messaging Endpoints
    • Message Construction
    • Messaging Channels
    • Message Routing
    • Message Transformation
    • System Management
  • Enterprise Integration Patterns (Basics)‏
    • Channel
    • Message
    • Pipes and Filters
    • Message Router
    • Message Translator
    • Message Endpoint
  • EIP (Routing/Transformation)‏
    • Message Filter
    • Splitter
    • Aggregator
    • Resequencer
    • Content Enricher
    • Content Filter
    • Normalizer
  • Beispiel (VeS)‏
    • Vollständig erfundenes Stammdatensystem
  • Apache Camel
    • Wurzeln in servicemix-eip, activemq
    • activemq, servicemix, cxf communities
    • implementiert 40 EIP
    • camel-core: commons-logging, jaxb, activation
    • 1.3.0 April 2008 (208 tasks), 1.4.0 Juli 2008 (261 tasks), 1.5.0 Oktober 2008 (266 tasks)‏
    • kommerzieller Support
  • Camel (Konzepte)‏
    • CamelContext
    • Component
    • Endpoint
    • Message/Exchange
    • Processor
    • RouteBuilder/Java DSL
  • CamelContext
    • Spring:
    • <camelContext id=&quot;camel&quot; xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;>
    • </camelContext>
    • Pure Java:
    • CamelContext camel = new DefaultCamelContext();
    • camelContext.start();
  • Component
    • Spring:
    • <bean id=&quot;activemq&quot; class=&quot;org.apache.camel.component.jms.JmsComponent&quot;>
    • <property name=&quot;connectionFactory&quot;>
    • <bean class=&quot;org.apache.activemq.ActiveMQConnectionFactory&quot;>
    • <property name=&quot;brokerURL&quot; value=&quot;vm://localhost?broker.persistent=false&quot;/>
    • </bean>
    • </property>
    • </bean>
    • Pure Java:
    • Component mailComponent = new org.apache.camel.component.mail.MailComponent();
  • Endpoint
    • Spring:
    • <cxf:cxfEndpoint id=&quot;routerEndpoint&quot; address=&quot;http://localhost:9003/CamelContext/RouterPort&quot;
    • serviceClass=&quot;org.apache.hello_world_soap_http.GreeterImpl&quot;/>
    • URI:
    • cxf:bean:routerEndpoint
    • Pure Java:
    • Endpoint endpoint = component.createEndpoint(&quot;log:com.mycompany.part2&quot;);
    • URI:
    • log:com.mycompany.part2
  • Message/Exchange/Processor
    • Pure Java:
    • Exchange exchange = endpoint.createExchange();
    • exchange.getIn().setBody(name);
    • public class MyProcessor implements Processor {
    • public void process(Exchange exchange) throws Exception {
    • // do something...
    • }
    • }
    • Processor myProcessor = new MyProcessor();
  • RouteBuilder
    • Spring:
    • <camelContext xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;>
    • <route>
    • <from uri=&quot;activemq:Input&quot;/>
    • <bean ref=&quot;myBeanName&quot; method=&quot;doTransform&quot;/>
    • <to uri=&quot;activemq:Output&quot;/>
    • </route>
    • </camelContext>
  • RouteBuilder (Java DSL)‏
    • Pure Java:
    • from(&quot;activemq:Input&quot;).beanRef(&quot;myBeanName&quot;, &quot;doTransform&quot;).to(&quot;activemq:Output&quot;);
    • RouteBuilder builder = new RouteBuilder() {
    • public void configure() {
    • from(&quot;queue:a&quot;).filter(header(&quot;foo&quot;).isEqualTo(&quot;bar&quot;)).to(&quot;queue:b&quot;);
    • from(&quot;queue:c&quot;).choice()‏
    • .when(header(&quot;foo&quot;).isEqualTo(&quot;bar&quot;)).to(&quot;queue:d&quot;)‏
    • .when(header(&quot;foo&quot;).isEqualTo(&quot;cheese&quot;)).to(&quot;queue:e&quot;)‏
    • .otherwise().to(&quot;queue:f&quot;);
    • }
    • };
    • myCamelContext.addRoutes(builder);
  • RouteBuilder (Scala DSL beta)‏
    • class MyRouteBuilder extends RouteBuilder {
    • &quot;direct:a&quot; --> &quot;mock:a&quot;
    • &quot;direct:b&quot; to &quot;mock:b&quot;
    • }
  • VeS (Splitter)‏
    • <camelContext id=&quot;camel&quot; xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;>
    • <route>
    • <from uri=&quot;cxf:requests&quot;/>
    • <splitter>
    • <xpath>/login | /account</xpath>
    • <to uri=&quot;direct:splitrequest&quot;/>
    • </splitter>
    • </route>
    • </camelContext>
  • VeS (Router)‏
    • RouteBuilder builder = new RouteBuilder() {
    • public void configure() {
    • from(&quot;direct:splitrequest&quot;).choice().when(xpath(&quot;/login&quot;)).to(&quot;seda:loginData&quot;)‏
    • .when(xpath(&quot;/account&quot;)).to(&quot;seda:accountData&quot;);
    • }
    • };
  • VeS (2. Router)‏
    • RouteBuilder builder = new RouteBuilder() {
    • public void configure() {
    • from(&quot;seda:accountData&quot;).choice().when(groovy(“request.account.id =~ /A.*/”))‏
    • .to(&quot;seda:oldAccountData&quot;)‏
    • .when(groovy(&quot;request.account.id =~ /B.*/&quot;)).to(&quot;seda:newAccountData&quot;);
    • }
    • };
  • VeS (Transformation)‏
    • <route>
    • <from uri=&quot;seda:loginData&quot;/>
    • <bean ref=&quot;loginBackend&quot; method=&quot;doTransform&quot;/>
    • <to uri=&quot;seda:loginBackend&quot;/>
    • </route>
  • Expression Languages
    • from(&quot;queue:a&quot;).filter( header(&quot;foo&quot;).isEqualTo(&quot;bar&quot;) ).to(&quot;queue:b&quot;);
    • Expression Language filter().el(&quot;${in.headers['My Header'] == 'bar'}&quot;)‏
    • OGNL filter().ognl(&quot;request.headers.foo = 'bar'&quot;)‏
    • Javascript filter().javaScript(&quot;request.headers.get('user') == 'admin'&quot;)‏
    • Groovy filter().groovy(&quot;request.lineItems.any { i -> i.value > 100 }&quot;)‏
    • Python filter().python(&quot;request.headers['user'] == 'admin'&quot;)‏
    • Ruby filter().ruby(&quot;$request.headers['user'] == 'admin'&quot;)‏
    • Xpath filter().xpath(&quot;//foo&quot;)‏
    • Xquery filter().xquery(&quot;//foo&quot;)‏
    • Scripting languages via JSR223
  • Components
    • ActiveMQ (activemq:FOO.BAR)‏
    • Atom (atom://atomUri)‏
    • CXF (cxf:bean:cxfEndpoint)‏
    • Spring events (spring-event://default)‏
    • File ( file://inputdir/?delete=true )‏
    • Financial Information eXchange (fix://configurationResource)‏
  • Components
    • Flatpack (flatpack:fixed:foo.pzmap.xml)‏
    • FTP (ftp://camelrider@localhost:21/public/downloads)‏
    • HL7 (Health Level 7)‏
    • HTTP/Jetty
    • JBI (jbi:service:http://foo.bar.org/Service)‏
    • Java Content Repository (jcr://user:pass@repository/repo)‏
  • Components
    • JMS (jms:FOO.BAR)‏
    • JPA (jpa:account)‏
    • LDAP (ldap:localhost:1024)‏
    • Log (log:org.camel.example.Foo)‏
    • Mail (imap://admin@mymailserver.com)‏
    • Mina (mina:tcp://localhost:6200?textline=true)‏
    • Mock (mock:foo)‏
    • RMI (rmi://localhost:1099/foo)‏
  • Components
    • Seda (seda:start)‏
    • Smooks (EDI parsing)‏
    • Test (test:file://data/expectedOutput)‏
    • Timer (timer://foo?fixedRate=true&period=60000)‏
    • Velocity (velocity:com/acme/MyResponse.vm)‏
    • Vm (vm:foo)‏
    • Xmpp (xmpp://fromAlias/toAlias)‏
  • Möglichkeiten
    • BAM (Wiretap Pattern)‏
    • Bean Integration
    • Visualisierung
    • Komponenten- erstellung
  • Fazit
    • Apache Camel ist
    • klein
    • leicht
    • fokussiert
    • modular
    • Don't get the hump, try Camel today.
  • Credits
    • the camel riders
    • IBM System 360 (CC cote on flickr)‏
    • the camel's way (CC lovelypetal on flickr)‏