• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Camel overview
 

Camel overview

on

  • 485 views

 

Statistics

Views

Total Views
485
Views on SlideShare
484
Embed Views
1

Actions

Likes
0
Downloads
4
Comments
0

1 Embed 1

https://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

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

    Camel overview Camel overview Presentation Transcript

    • Implemen(ng  Enterprise  Integra(on   Pa3erns  through  Apache  Camel   James  Strachan,  Red  Hat 1Friday, February 8, 2013
    • Your  speaker  today  James  Strachan • jstrachan@redhat.com • twi8er:  @jstrachan • blog:  h8p://macstrac.blogspot.com/  Senior  Consul(ng  SoFware  Engineer  at  Red  Hat • leaders  in  open  source  middleware  &  integra?on • we  provide  training,  consul?ng,  support,  distribu?ons  &  tools  for  open   source  integra?on  soCware  Open  Source  hacker • created  the  Groovy  programming  language • created  Apache  Camel • co-­‐founder  of – Apache  Ac(veMQ,  ServiceMix,  Geronimo – Scalate • lets  not  men?on  Jelly  :) 2 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • What  are  Enterprise  Integra?on  Pa8erns? 3 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Book  by  Gregor  &  Bobby! 4 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • A  selec?on  of  some  of  the  pa8erns... 5 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • What  is  Apache  Camel? http://camel.apache.org/ 6 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • What  is  Apache  Camel? Apache  Camel  is  a  Powerful  Open  Source Integra(on  Framework based  on  known Enterprise  Integra(on  Pa3erns   h3p://camel.apache.org/enterprise-­‐integra(on-­‐pa3erns.html 7 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Lets  look  at  a  pa8ern! 8 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Message  Filter 9 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Message  Filter  :  XML <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext> 10 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Message  Filter  :  Spring  XML <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext> </beans> 11 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Message  Filter  :  XML <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext> 12 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Expressions  &  Predicates 15 Expression Languages BeanShell Python EL Ruby Groovy Simple JavaScript SpEL JSR 223 SQL OGNL XPath MVEL XQuery PHP 13 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • URIs,  Endpoints  and  Components  (120+) h8p://camel.apache.org/components.html activemq cxf flatpack jasypt activemq-journal cxfrs freemarker javaspace amqp dataset ftp/ftps/sftp jbi atom db4o gae jcr bean direct hdfs jdbc bean validation ejb hibernate jetty browse esper hl7 jms cache event http jmx cometd exec ibatis jpa crypto file irc jt/400 14 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • 120+  components... language properties seda stream ldap quartz servlet string-template mail/imap/pop3 quickfix sip test mina ref smooks timer mock restlet smpp validation msv rmi snmp velocity nagios rnc spring-integration vm netty rng spring-security xmpp nmr rss spring-ws xquery printer scalate sql xslt 15 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Message  Filter  :  XML <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext> 16 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Message  Filter  :  Java from("activemq:topic:Quotes”). filter().xpath("/quote/product = ‘widget’"). to("mqseries:WidgetQuotes"); 17 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Message  Filter  :  Java  Complete package com.acme.quotes; import org.apache.camel.builder.RouteBuilder; public class MyRouteBuilder extends RouteBuilder { public void configure() { // forward widget quotes to MQSeries from("activemq:topic:Quotes”). filter().xpath("/quote/product = ‘widget’"). to("mqseries:WidgetQuotes"); } } 18 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Message  Filter  :  Scala   "direct:a" when(_.in == "<hello/>") { to("mock:a") } 19 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Create  CamelContext  in  Spring <camelContext xmlns="http://camel.apache.org/schema/spring"> <package>com.acme.quotes</package> </camelContext> 20 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Create  CamelContext  in  Java CamelContext context = new DefaultCamelContext(); context.addRoutes(new MyRouteBuilder()); context.start(); 21 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • IDE  support Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • IDE  support  (XML) 23 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Recap  -­‐  core  concepts  of  Camel  Enterprise  Integra(on  Pa3erns  Rou(ng  Domain  Specific  Language  (DSL)  Endpoints  &  URIs  Predicates  &  Expressions  Components  (lots  of  ‘em!)  Test  Kit               and  much  more  ... 24 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Beans 25 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Bean  as  a  Message  Translator from("activemq:Incoming”). beanRef("myBeanName”, “someMethod"). to("activemq:Outgoing"); 26 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Bean   public class Foo { public String someMethod(String name) { return “Hello “ + name; } } 27 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Binding  Beans  to  Camel  Endpoints public class Foo { @Consume(uri="activemq:cheese") public Object onCheese(String name) { ... } } 28 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Binding  Method  Arguments public class Foo { public Object onCheese( @XPath("/foo/bar") String name, @Header("JMSCorrelationID") String id) { ... } } for  more  annota(ons  see h3p://camel.apache.org/bean-­‐integra(on.html 29 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Sending  messages  to  endpoints public class Foo { @Produce(uri="activemq:foo.bar") ProducerTemplate producer; public void doSomething() { if (whatever) { producer.sendBody("<hello>world!</hello>"); } } } 30 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Sending  messages  to  endpoints public interface MyListener { String sayHello(String name); } public class MyBean { @Produce(uri = "activemq:foo") protected MyListener producer; public void doSomething() { // lets send a message String response = producer.sayHello("James"); } } 31 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Fastest  way  to  learn....  Manning  top-­‐15  year  to  date  (2010) #10 #12 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Fuse  IDE:  the  fastest  way  to  get  riding!  free  eclipse  based  tool  for  Apache  Camel  &  Ac(veMQ  etc • create  projects,  edit  routes,  run  stuff,  visualise,  trace  &  diagnose h3p://fusesource.com/ 33 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Summary:  Camel  rocks  Ride  that  Camel • h8p://camel.apache.org/  Download  Fuse  IDE • h8p://fusesource.com  Buy  the  book!    Don’t  get  the  hump! 34 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013
    • Any  Ques(ons? twi3er:  @jstrachan  #fusenews h3p://fusesource.com 35 Copyright  ©  2013  Red  Hat,  Inc.  All  rights  reserved.  Friday, February 8, 2013