This is not the document you are looking for? Use the search form below to find more!

Report home > Others

Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix

0.00 (0 votes)
Document Description
Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix
File Details
Submitter
  • Name: niklas
Embed Code:

Add New Comment




Related Documents

Building enterprise web applications with spring 3

by: leona, 81 pages

Building Enterprise Web Applications with Spring 3.0 and Spring 3.0 MVC JavaOne 2010ByAbdelmonaimRemaniabdelmonaim.remani@gmail.comCreative Commons ...

Panasonic FV-11VQCL5 Whispersense Lite 110 CFM Ceiling Mounted Ventilation Fan Light With Dual Sensor Motion And Humidity Technology

by: john753shirley, 1 pages

moisture control codes such as CALGreen.User-friendly installation-detachable adaptors, firmly secured duct ends,

Panasonic FV-11VQCL5 Whispersense Lite 110 CFM Ceiling Mounted Ventilation Fan Light With Dual Sensor Motion And Humidity Technology

by: donna59walters, 1 pages

moisture control codes such as CALGreen.User-friendly installation-detachable adaptors, firmly secured duct ends,

Panasonic FV-11VQCL5 Whispersense Lite 110 CFM Ceiling Mounted Ventilation Fan Light With Dual Sensor Motion And Humidity Technology

by: james671clark, 1 pages

moisture control codes such as CALGreen.User-friendly installation-detachable adaptors, firmly secured duct ends,

Enterprise Messaging With ActiveMQ and Spring JMS

by: molly, 73 pages

Enterprise Messaging With ActiveMQ and Spring JMS

Fast SOA with Apache Synapse

by: giovanni, 33 pages

High Speed SOA with Apache Synapse Paul Fremantle VP, Apache Synapse CTO, WSO2 [email_address] Contents What is Apache Synapse History of the project ...

Content Storage With Apache Jackrabbit

by: armida, 25 pages

Content Storage with Apache Jackrabbit 2009-03-25, Jukka Zitting Introducing JCR Content Repository for Java ™ Technology API -> Version 1.0 defined ...

Building SOA solutions with Apache Tuscany

by: desi, 10 pages

Apache Tuscany A quick introduction http://tuscany.apache.org Haleh Mahbod Apache Tuscany committer and PMC member [email_address] April 12, 2009, Update Aug 10, 2009 Meet Apache ...

Practical Problem Solving with Apache Hadoop & Pig

by: govert, 199 pages

Practical Problem Solving with Apache Hadoop & Pig

Integration Test With Cucumber And Webrat

by: joel, 29 pages

Integration Test With Cucumber And Webrat

Content Preview
  1. Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix James Strachan http://macstrac.blogspot.com/ http://open.iona.com/
  2. What are Enterprise Integration Patterns?
  3. Book by Gregor & Bobby!
  4. A selection of some of the patterns...
  5. What is Camel?
  6. Why?
  7. Aims of Camel to make integration as simple as it can possibly be
  8. What is Camel? http://activemq.apache.org/camel/
  9. What is Camel? Spring based Enterprise Integration Patterns http://activemq.apache.org/camel/enterprise-integration-patterns.html
  10. A selection of some of the patterns...
  11. Lets look at a pattern!
  12. Message Filter
  13. Message Filter : XML <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext>
  14. 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://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd"> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext> </beans>
  15. Message Filter : XML <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext>
  16. Expressions & Predicates BeanShell PHP EL Python Groovy Ruby JavaScript SQL JSR 223 XPath OGNL XQuery
  17. URIs, Endpoints and Components http://activemq.apache.org/camel/components.html activemq ibatis mail rmi udp activemq.journal imap mina rnc validation bean irc mock rng velocity cxf jdbc msv seda vm direct jetty multicast sftp xmpp event jbi pojo smtp xquery ?le jms pop string-template xslt ftp jpa quartz timer webdav http log queue tcp
  18. Message Filter : XML <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext>
  19. Message Filter : Java from("activemq:topic:Quotes). filter().xpath("/quote/product = ‘widget’"). to("mqseries:WidgetQuotes");
  20. 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"); } }
  21. Create CamelContext in Java CamelContext context = new DefaultCamelContext(); context.addRoutes(new MyRouteBuilder()); context.start();
  22. Create CamelContext in Spring <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <package>com.acme.quotes</package> </camelContext>
  23. More Patterns!
  24. Content Based Router
  25. Content Based Router <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="activemq:NewOrders"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:Orders.Widgets"/> </when> <when> <xpath>/order/product = 'gadget'</xpath> <to uri="activemq:Orders.Gadgets"/> </when> <otherwise> <to uri="activemq:Orders.Bad"/> </otherwise> </choice> </route> </camelContext>
  26. Splitter
  27. Splitter from("file://orders"). splitter(body().tokenize("n")). to("activemq:Order.Items");
  28. Splitter using XQuery from("file://orders"). splitter().xquery("/order/items"). to("activemq:Order.Items");
  29. Aggregator
  30. Aggregator from("activemq:Inventory.Items"). aggregator().xpath("/order/@id"). to("activemq:Inventory.Order");
  31. Message Translator
  32. Message Translator from("file://incoming”). to("xslt:com/acme/mytransform.xsl"). to("http://outgoing.com/foo");
  33. Quick recap
  34. Beans
  35. Bean as a Message Translator from("activemq:Incoming”). beanRef("myBeanName"). to("activemq:Outgoing");
  36. Bean public class Foo { public void someMethod(String name) { ... } }
  37. Bean as a Message Translator with method name from("activemq:Incoming”). beanRef("myBeanName", "someMethod"). to("activemq:Outgoing");
  38. Type Conversion
  39. Type Conversion package com.acme.foo.converters; import org.apache.camel.Converter; import java.io.*; @Converter public class IOConverter { @Converter public static InputStream toInputStream(File file) throws FileNotFoundException { return new BufferedInputStream(new FileInputStream(file)); } } # META-INF/services/org/apache/camel/TypeConverter com.acme.foo.converters
  40. Binding Beans to Camel Endpoints public class Foo { @MessageDriven(uri="activemq:cheese") public void onCheese(String name) { ... } }
  41. Binding Method Arguments public class Foo { public void onCheese( @XPath("/foo/bar") String name, @Header("JMSCorrelationID") String id) { ... } } for more annotations see http://activemq.apache.org/camel/bean-integration.html
  42. Injecting endpoints into beans public class Foo { @EndpointInject(uri="activemq:foo.bar") ProducerTemplate producer; public void doSomething() { if (whatever) { producer.sendBody("<hello>world!</hello>"); } } }
  43. Spring Remoting - Client Side <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <proxy id="sayService" serviceUrl="activemq:MyService" serviceInterface="com.acme.MyServiceInterface"/> </camelContext>
  44. Spring Remoting - Server Side <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <export id="sayService" uri="activemq:MyService" serviceRef="sayImpl" serviceInterface="com.acme.MyServiceInterface"/> </camelContext> <bean id="sayImpl" class="com.acme.MyServiceImpl"/>
  45. Dependency Injection <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> ... </camelContext> <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent"> <property name="connectionFactory"> <bean class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="vm://localhost?broker.persistent=false"/> </bean> </property> </bean>
  46. Data Format from("activemq:QueueWithJavaObjects). marshal().jaxb(). to("mqseries:QueueWithXmlMessages");
  47. Business Activity Monitoring (BAM)
  48. Business Activity Monitoring (BAM) public class MyActivities extends ProcessBuilder { public void configure() throws Exception { // lets define some activities, correlating on an XPath on the message bodies ActivityBuilder purchaseOrder = activity("activemq:PurchaseOrders") .correlate(xpath("/purchaseOrder/@id").stringResult()); ActivityBuilder invoice = activity("activemq:Invoices") .correlate(xpath("/invoice/@purchaseOrderId").stringResult()); // now lets add some BAM rules invoice.starts().after(purchaseOrder.completes()) .expectWithin(seconds(1)) .errorIfOver(seconds(2)).to("activemq:FailedProcesses"); } }
  49. Riding the camel
  50. Where would I use Camel? •standalone or in any Spring application •inside ActiveMQ’s JMS client or the broker •inside your ESB such as ServiceMix via the servicemix-camel Service Unit •inside CXF either as a transport or reusing CXF inside Camel
  51. Camel Riding from Java •/META-INF/spring/camelContext.xml •set the CLASSPATH •java org.apache.camel.spring.Main
  52. Maven Tooling <project> ... <build> <plugins> <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId> </plugin> </plugins> </build> <reporting> <plugins> <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId> </plugin> </plugins> </reporting> </project> mvn camel:run
  53. Maven Plugin Site Report
  54. Where do I get more info? please do take Camel for a ride! http://activemq.apache.org/camel/ don’t get the hump! :-)
  55. Questions?
  56. James Strachan blog http://macstrac.blogspot.com/
  57. Camel v Mule • A Camel can carry 4 times as much load as other beasts of burden! http://activemq.apache.org/camel/why-the-name-camel.html
  58. Camel v Mule •Camel provides a higher level abstraction for EIP; making it simpler & easier & less XML •Awesome integration with JMS + ActiveMQ (client and broker), JBI + ServiceMix and JAX-WS + CXF •great testing with Camel’s Mock Endpoint •Business Activity Monitoring framework
  59. Where do I get more info? please do take Camel for a ride! http://activemq.apache.org/camel/ don’t get the hump! :-)

Download
Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix

 

 

Your download will begin in a moment.
If it doesn't, click here to try again.

Share Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix to:

Insert your wordpress URL:

example:

http://myblog.wordpress.com/
or
http://myblog.com/

Share Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix as:

From:

To:

Share Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix.

Enter two words as shown below. If you cannot read the words, click the refresh icon.

loading

Share Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix as:

Copy html code above and paste to your web page.

loading