SlideShare una empresa de Scribd logo
1 de 31
Descargar para leer sin conexión
Implementing Enterprise Integration
     Patterns through Apache Camel




    Andrea Leoncini, Red Hat
     1

lunedì 18 febbraio 13
Your speaker today


      Andrea Leoncini
            • andrea.leoncini@redhat.com
            • twitter: @leopericoli
      Senior Middleware Solution Architect at Red Hat
            • leaders in open source middleware & integration
            • we provide training, consulting, support, distributions & tools for open
              source integration software
      In the community
            •      co-founder of JUG Roma
            •      co-founder of JBUG Roma, JBUG Milano
            •      andrea.leoncini @JBoss Community
            •      pride founder of JBoss Consulting Team in Italy




      2         Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
What are Enterprise Integration Patterns?




      3      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
Book by Gregor & Bobby!




      4      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
A selection of some of the patterns...




      5      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
What is Apache Camel?


                                                        http://camel.apache.org/




      6      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
What is Apache Camel?




                        Apache Camel is a Powerful Open
                                     Source
                             Integration Framework
                                based on known
                         Enterprise Integration Patterns

           http://camel.apache.org/enterprise-integration-patterns.html



      7      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
Lets look at a pattern!




      8      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
Message Filter




      9      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13
URIs, Endpoints and Components (120+)


                              http://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.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13
Message Filter : Java




      from("activemq:topic:Quotes”).
        filter().xpath("/quote/product = ‘widget’").
          to("mqseries:WidgetQuotes");




     17      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13
Message Filter : Scala




                   "direct:a" when(_.in == "<hello/>") {
                       to("mock:a")
                   }




     19      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13
Create CamelContext in Java




           CamelContext context = new DefaultCamelContext();
           context.addRoutes(new MyRouteBuilder());
           context.start();




     21      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
IDE support




             Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
IDE support (XML)




     23      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
Recap - core concepts of Camel


         Enterprise Integration Patterns
         Routing
         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.

lunedì 18 febbraio 13
Beans




     25      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
Bean as a Message Translator




          from("activemq:Incoming”).
            beanRef("myBeanName”, “someMethod").
              to("activemq:Outgoing");




     26      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
Bean




     public class Foo {

           public String someMethod(String name) {
             return “Hello “ + name;
           }
     }




     27      Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13
Binding Method Arguments




          public class Foo {

               public Object onCheese(
                 @XPath("/foo/bar") String name,
                 @Header("JMSCorrelationID") String id) {
                 ...
               }
          }
                           for more annotations see
                           http://camel.apache.org/bean-integration.html


     29       Copyright © 2013 Red Hat, Inc. All rights reserved.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13
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.

lunedì 18 febbraio 13

Más contenido relacionado

La actualidad más candente

Apache camel overview dec 2011
Apache camel overview dec 2011Apache camel overview dec 2011
Apache camel overview dec 2011
Marcelo Jabali
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
Bruno Oliveira
 
解读server.xml文件
解读server.xml文件解读server.xml文件
解读server.xml文件
wensheng wei
 
PHP Performance with APC + Memcached
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
Ford AntiTrust
 

La actualidad más candente (20)

Apache camel overview dec 2011
Apache camel overview dec 2011Apache camel overview dec 2011
Apache camel overview dec 2011
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyists
 
Tomcat configuration
Tomcat configurationTomcat configuration
Tomcat configuration
 
30 Minutes To CPAN
30 Minutes To CPAN30 Minutes To CPAN
30 Minutes To CPAN
 
Hybrid Applications
Hybrid ApplicationsHybrid Applications
Hybrid Applications
 
Java7 - Top 10 Features
Java7 - Top 10 FeaturesJava7 - Top 10 Features
Java7 - Top 10 Features
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
Scala
ScalaScala
Scala
 
Devignition 2011
Devignition 2011Devignition 2011
Devignition 2011
 
When Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of TorqueboxWhen Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of Torquebox
 
Fluentd in Co-Work
Fluentd in Co-WorkFluentd in Co-Work
Fluentd in Co-Work
 
OSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian SchneiderOSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian Schneider
 
Find bottleneck and tuning in Java Application
Find bottleneck and tuning in Java ApplicationFind bottleneck and tuning in Java Application
Find bottleneck and tuning in Java Application
 
Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012
Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012
Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
 
解读server.xml文件
解读server.xml文件解读server.xml文件
解读server.xml文件
 
Php version 5
Php version 5Php version 5
Php version 5
 
PHP Performance with APC + Memcached
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
 
Toster - Understanding the Rails Web Model and Scalability Options
Toster - Understanding the Rails Web Model and Scalability OptionsToster - Understanding the Rails Web Model and Scalability Options
Toster - Understanding the Rails Web Model and Scalability Options
 

Similar a Camel and JBoss

Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
FuseSource.com
 
Deploying JRuby Web Applications
Deploying JRuby Web ApplicationsDeploying JRuby Web Applications
Deploying JRuby Web Applications
Joe Kutner
 
SD, a P2P bug tracking system
SD, a P2P bug tracking systemSD, a P2P bug tracking system
SD, a P2P bug tracking system
Jesse Vincent
 
Enterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQEnterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQ
elliando dias
 

Similar a Camel and JBoss (20)

Easy Integration with Apache Camel and Fuse IDE
Easy Integration with Apache Camel and Fuse IDEEasy Integration with Apache Camel and Fuse IDE
Easy Integration with Apache Camel and Fuse IDE
 
Camel overview
Camel overview Camel overview
Camel overview
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
S314011 - Developing Composite Applications for the Cloud with Apache Tuscany
S314011 - Developing Composite Applications for the Cloud with Apache TuscanyS314011 - Developing Composite Applications for the Cloud with Apache Tuscany
S314011 - Developing Composite Applications for the Cloud with Apache Tuscany
 
20160908 hivemall meetup
20160908 hivemall meetup20160908 hivemall meetup
20160908 hivemall meetup
 
Fisl - Deployment
Fisl - DeploymentFisl - Deployment
Fisl - Deployment
 
What's New and Newer in Apache httpd-24
What's New and Newer in Apache httpd-24What's New and Newer in Apache httpd-24
What's New and Newer in Apache httpd-24
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
Ruby off Rails (english)
Ruby off Rails (english)Ruby off Rails (english)
Ruby off Rails (english)
 
Deploying JRuby Web Applications
Deploying JRuby Web ApplicationsDeploying JRuby Web Applications
Deploying JRuby Web Applications
 
Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2
 
Apache Camel K - Copenhagen
Apache Camel K - CopenhagenApache Camel K - Copenhagen
Apache Camel K - Copenhagen
 
Automated Java Deployments With Rpm
Automated Java Deployments With RpmAutomated Java Deployments With Rpm
Automated Java Deployments With Rpm
 
IPv6 Matrix presentation for World IPv6 Launch, June 2012
IPv6 Matrix presentation for World IPv6 Launch, June 2012IPv6 Matrix presentation for World IPv6 Launch, June 2012
IPv6 Matrix presentation for World IPv6 Launch, June 2012
 
apachecamelk-april2019-190409093034.pdf
apachecamelk-april2019-190409093034.pdfapachecamelk-april2019-190409093034.pdf
apachecamelk-april2019-190409093034.pdf
 
The Cloud-natives are RESTless @ JavaOne
The Cloud-natives are RESTless @ JavaOneThe Cloud-natives are RESTless @ JavaOne
The Cloud-natives are RESTless @ JavaOne
 
44CON London 2015 - Going AUTH the Rails on a Crazy Train
44CON London 2015 - Going AUTH the Rails on a Crazy Train44CON London 2015 - Going AUTH the Rails on a Crazy Train
44CON London 2015 - Going AUTH the Rails on a Crazy Train
 
SD, a P2P bug tracking system
SD, a P2P bug tracking systemSD, a P2P bug tracking system
SD, a P2P bug tracking system
 
Scalding - Big Data Programming with Scala
Scalding - Big Data Programming with ScalaScalding - Big Data Programming with Scala
Scalding - Big Data Programming with Scala
 
Enterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQEnterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQ
 

Más de JBug Italy

JBoss AS7 Overview
JBoss AS7 OverviewJBoss AS7 Overview
JBoss AS7 Overview
JBug Italy
 

Más de JBug Italy (20)

JBoss Wise: breaking barriers to WS testing
JBoss Wise: breaking barriers to WS testingJBoss Wise: breaking barriers to WS testing
JBoss Wise: breaking barriers to WS testing
 
AS7 and CLI
AS7 and CLIAS7 and CLI
AS7 and CLI
 
Intro jbug milano_26_set2012
Intro jbug milano_26_set2012Intro jbug milano_26_set2012
Intro jbug milano_26_set2012
 
Infinispan,Lucene,Hibername OGM
Infinispan,Lucene,Hibername OGMInfinispan,Lucene,Hibername OGM
Infinispan,Lucene,Hibername OGM
 
AS7
AS7AS7
AS7
 
JBoss BRMS - The enterprise platform for business logic
JBoss BRMS - The enterprise platform for business logicJBoss BRMS - The enterprise platform for business logic
JBoss BRMS - The enterprise platform for business logic
 
JBoss AS7 Overview
JBoss AS7 OverviewJBoss AS7 Overview
JBoss AS7 Overview
 
Intro JBug Milano - January 2012
Intro JBug Milano - January 2012Intro JBug Milano - January 2012
Intro JBug Milano - January 2012
 
JBoss AS7 Webservices
JBoss AS7 WebservicesJBoss AS7 Webservices
JBoss AS7 Webservices
 
JBoss AS7
JBoss AS7JBoss AS7
JBoss AS7
 
Intro JBug Milano - September 2011
Intro JBug Milano - September 2011Intro JBug Milano - September 2011
Intro JBug Milano - September 2011
 
All the cool stuff of JBoss BRMS
All the cool stuff of JBoss BRMSAll the cool stuff of JBoss BRMS
All the cool stuff of JBoss BRMS
 
Infinispan and Enterprise Data Grid
Infinispan and Enterprise Data GridInfinispan and Enterprise Data Grid
Infinispan and Enterprise Data Grid
 
Drools Introduction
Drools IntroductionDrools Introduction
Drools Introduction
 
September 2010 - Arquillian
September 2010 - ArquillianSeptember 2010 - Arquillian
September 2010 - Arquillian
 
September 2010 - Gatein
September 2010 - GateinSeptember 2010 - Gatein
September 2010 - Gatein
 
May 2010 - Infinispan
May 2010 - InfinispanMay 2010 - Infinispan
May 2010 - Infinispan
 
May 2010 - RestEasy
May 2010 - RestEasyMay 2010 - RestEasy
May 2010 - RestEasy
 
May 2010 - Drools flow
May 2010 - Drools flowMay 2010 - Drools flow
May 2010 - Drools flow
 
May 2010 - Hibernate search
May 2010 - Hibernate searchMay 2010 - Hibernate search
May 2010 - Hibernate search
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Camel and JBoss

  • 1. Implementing Enterprise Integration Patterns through Apache Camel Andrea Leoncini, Red Hat 1 lunedì 18 febbraio 13
  • 2. Your speaker today  Andrea Leoncini • andrea.leoncini@redhat.com • twitter: @leopericoli  Senior Middleware Solution Architect at Red Hat • leaders in open source middleware & integration • we provide training, consulting, support, distributions & tools for open source integration software  In the community • co-founder of JUG Roma • co-founder of JBUG Roma, JBUG Milano • andrea.leoncini @JBoss Community • pride founder of JBoss Consulting Team in Italy 2 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 3. What are Enterprise Integration Patterns? 3 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 4. Book by Gregor & Bobby! 4 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 5. A selection of some of the patterns... 5 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 6. What is Apache Camel? http://camel.apache.org/ 6 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 7. What is Apache Camel? Apache Camel is a Powerful Open Source Integration Framework based on known Enterprise Integration Patterns http://camel.apache.org/enterprise-integration-patterns.html 7 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 8. Lets look at a pattern! 8 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 9. Message Filter 9 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 10. 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. lunedì 18 febbraio 13
  • 11. 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. lunedì 18 febbraio 13
  • 12. 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. lunedì 18 febbraio 13
  • 13. 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. lunedì 18 febbraio 13
  • 14. URIs, Endpoints and Components (120+) http://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. lunedì 18 febbraio 13
  • 15. 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. lunedì 18 febbraio 13
  • 16. 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. lunedì 18 febbraio 13
  • 17. Message Filter : Java from("activemq:topic:Quotes”). filter().xpath("/quote/product = ‘widget’"). to("mqseries:WidgetQuotes"); 17 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 18. 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. lunedì 18 febbraio 13
  • 19. Message Filter : Scala "direct:a" when(_.in == "<hello/>") { to("mock:a") } 19 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 20. 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. lunedì 18 febbraio 13
  • 21. Create CamelContext in Java CamelContext context = new DefaultCamelContext(); context.addRoutes(new MyRouteBuilder()); context.start(); 21 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 22. IDE support Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 23. IDE support (XML) 23 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 24. Recap - core concepts of Camel  Enterprise Integration Patterns  Routing  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. lunedì 18 febbraio 13
  • 25. Beans 25 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 26. Bean as a Message Translator from("activemq:Incoming”). beanRef("myBeanName”, “someMethod"). to("activemq:Outgoing"); 26 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 27. Bean public class Foo { public String someMethod(String name) { return “Hello “ + name; } } 27 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 28. 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. lunedì 18 febbraio 13
  • 29. Binding Method Arguments public class Foo { public Object onCheese( @XPath("/foo/bar") String name, @Header("JMSCorrelationID") String id) { ... } } for more annotations see http://camel.apache.org/bean-integration.html 29 Copyright © 2013 Red Hat, Inc. All rights reserved. lunedì 18 febbraio 13
  • 30. 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. lunedì 18 febbraio 13
  • 31. 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. lunedì 18 febbraio 13