Getting started with Apache Camel presentation at BarcelonaJUG, january 2014

Embed Size (px)

Citation preview

Getting Started with Apache Camel.Presentation and Workshop at BarcelonaJUG, January 2014

Claus Ibsen (@davsclaus)Principal Software Engineer, Red Hat

Agenda

History of Camel

What is Apache Camel?

A little Example

Riding Camel

What's in the Camel box?

Deploying Camel

Creating new Camel Projects

What's not in the Camel box?

More Information

Your Speaker

Principal Software Engineer at Red Hat

Apache Camel6 years working with Camel

Author of Camel in Action book

ContactEMail: [email protected]

Twitter: @davsclaus

Blog: http://davsclaus.com

Linkedin: http://www.linkedin.com/in/davsclaus

Why the name Camel?

Why the name Camel?

Because Camel is
easy to remember and type ...

Why the name Camel?

or the creator used to smoke cigarets!

http://camel.apache.org/why-the-name-camel.html

Camel's parents

Camel's parents

James Strachan (creator of Camel)
Gregor Hohpe (author of EIP book)

The birth of Camel

First Commit

The birth of Camel

My first Commit

The birth of Camel

First ReleaseApache Camel 1.0
June 2007

http://www.davsclaus.com/2012/05/looking-at-impressive-first-apache.html

Agenda

History of Camel

What is Apache Camel?

A little Example

Riding Camel

What's in the Camel box?

Deploying Camel

Creating new Camel Projects

What's not in the Camel box?

More Information

What is Apache Camel?

Quote from the website

What is Apache Camel?

Why do we need integration?Critical for your business to integrate

Why Integration Framework?Framework do the heavy lifting

You can focus on business problem

Not "reinventing the wheel"

What is Apache Camel?

What is Enterprise Integration Patterns?

It's a book

What is Apache Camel?

Enterprise Integration Patterns

http://camel.apache.org/eip

What is Apache Camel?

EIP - Content Based Router

What is Apache Camel?

from newOrder

What is Apache Camel?

from newOrder choice

What is Apache Camel?

from newOrder choice when isWidget to widget

What is Apache Camel?

from newOrder choice when isWidget to widget otherwise to gadget

What is Apache Camel?

from(newOrder) choice when(isWidget) to(widget) otherwise to(gadget)

What is Apache Camel?

from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);

What is Apache Camel?

Endpoint newOrder = endpoint("activemq:queue:newOrder");

from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);

What is Apache Camel?

Endpoint newOrder = endpoint("activemq:queue:newOrder");Predicate isWidget = xpath("/order/product = 'widget'");

from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);

What is Apache Camel?

Endpoint newOrder = endpoint("activemq:queue:newOrder");Predicate isWidget = xpath("/order/product = 'widget'");Endpoint widget = endpoint("activemq:queue:widget");Endpoint gadget = endpoint("activemq:queue:gadget");

from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);

What is Apache Camel?

Java Code

public void configure() throws Exception { Endpoint newOrder = endpoint("activemq:queue:newOrder"); Predicate isWidget = xpath("/order/product = 'widget'"); Endpoint widget = endpoint("activemq:queue:widget"); Endpoint gadget = endpoint("activemq:queue:gadget");

from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget) .end(); }

What is Apache Camel?

Java Code

import org.apache.camel.Endpoint;import org.apache.camel.Predicate;import org.apache.camel.builder.RouteBuilder;

public class MyRoute extends RouteBuilder {

public void configure() throws Exception { Endpoint newOrder = endpoint("activemq:queue:newOrder"); Predicate isWidget = xpath("/order/product = 'widget'"); Endpoint widget = endpoint("activemq:queue:widget"); Endpoint gadget = endpoint("activemq:queue:gadget");

from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget) .end(); }}

What is Apache Camel?

Camel Java DSL

import org.apache.camel.builder.RouteBuilder;

public class MyRoute extends RouteBuilder {

public void configure() throws Exception { from("activemq:queue:newOrder") .choice() .when(xpath("/order/product = 'widget'")) .to("activemq:queue:widget") .otherwise() .to("activemq:queue:gadget") .end(); }}

What is Apache Camel?

Camel XML DSL

/order/product = 'widget'

What is Apache Camel?

Endpoint as URIs

/order/product = 'widget'

use file instead

What is Apache Camel?

Endpoint as URIs

/order/product = 'widget'

parameters

Standard Java or XML

Java DSL is just Java

Standard Java or XML

XML DSL is just XML








with XSD schema for validation/tooling

What is Apache Camel?

Camel's Architecture

What is Apache Camel?

150+ Components

What is Apache Camel?

150+ Components

What is Apache Camel?

SummaryIntegration Framework

Enterprise Integration Patterns (EIP)

Routing (using DSL)

Easy Configuration (endpoint as uri's)

Just Java or XML code

No Container Dependency

A lot of components

Agenda

History of Camel

What is Apache Camel?

A little Example

Riding Camel

What's in the Camel box?

Deploying Camel

Creating new Camel Projects

What's not in the Camel box?

More Information

A Little Example

File Copier Example

A Little Example

File Copier Example

A Little Example

File Copier Example

A Little Example

File Copier Example

A Little Example

File Copier Example

Agenda

History of Camel

What is Apache Camel?

A little Example

Riding Camel

What's in the Camel box?

Deploying Camel

Creating new Camel Projects

What's not in the Camel box?

More Information

Riding Camel

Downloading Apache Camelzip/tarball (approx 8mb)

http://camel.apache.org

Riding Camel

Using Command ShellRequires: Apache Maven




From Eclipse

Riding Camel

Console Example






cd examples/camel-example-console

mvn compile exec:java

Riding Camel

Twitter Example






cd examples/camel-example-twitter-websocket

mvn compile exec:java

http://localhost:9090/index.html

Riding Camel

More examples ...






... and further details at website.

http://camel.apache.org/examples

Agenda

History of Camel

What is Apache Camel?

A little Example

Riding Camel

What's in the box?

Deploying Camel

Creating new Camel Projects

What's not in the Camel box?

More Information

What's in the box?

What's in the box?

Enterprise Integration Patterns

http://camel.apache.org/eip

What's in the box?

Pipes and Filters EIP

What's in the box?

Pipes and Filters EIP

What's in the box?

Recipient List EIP

What's in the box?

Recipient List EIP

What's in the box?

Splitter EIP

What's in the box?

150+ Components

What's in the box?

19 Data Formats

What's in the box?

15 Expression Languages

What's in the box?

5+ DSL in multiple languagesJava DSL

XML DSL (Spring and OSGi Blueprint)

Groovy DSL

Scala DSL

Kotlin DSL (work in progress)

What's in the box?

Mixing Java and XML

Java DSL

Spring XML file

What's in the box?

Mixing Java and XML.. having both XML and Java routes

Java routeXML route

What's in the box?

Multiple XML files

myCoolRoutes.xml

myOtherCoolRoutes.xml

myCamel.xml

What's in the box?

Scanning on classpath for Java routes with packageScan





supports excludes/includes

What's in the box?

Scanning Spring ApplicationContext for Java routes with







What's in the box?

Scanning Spring ApplicationContext for Java routes and routes uses @Component







What's in the box?

Type Converters

What's in the box?

Writing Custom Type Converter

What's in the box?

Bean as Message Translator

What's in the box?

Bean as Message Translator

What's in the box?

Working with beans

What's in the box?

Working with beans

What's in the box?

Working with beans

What's in the box?

Working with beans

What's in the box?

Test Kitcamel-testcamel-test-spring

camel-test-blueprintcamel-testng

What's in the box?

ManagementJMX

REST (w/ Jolokia)

What's in the box?

Error Handling

What's in the box?

try .. catch style

What's in the box?

Dead Letter Channel (EIP style)

What's in the box?

Dead Letter Channel (EIP style)

What's in the box?

The RestInterceptors

Security

Route Policy

Type Converters

TransactionCompensation as rollback

Asynchronous non-blocking routing engine

Thread management

Maven Tooling

... and much more

Agenda

History of Camel

What is Apache Camel?

A little Example

Riding Camel

What's in the Camel box?

Deploying Camel

Creating new Camel Projects

What's not in the Camel box?

More Information

Deploying Camel

Deployment StrategyNo Container Dependency

Lightweight & Embeddable

Deployment OptionsStandalone

WAR

Spring

JEE

OSGi

Cloud

Camel as a Client

Java Client Application (no routes)

ExampleUpload a file to a FTP server

Agenda

History of Camel

What is Apache Camel?

A little Example

Riding Camel

What's in the Camel box?

Deploying Camel

Creating new Camel Projects

What's not in the Camel box?

More Information

Creating new Camel Projects

Using Command Shell



From Eclipse

Creating new Camel Projects

Maven Archetypes

Creating new Camel Projects

camel-archetype-blueprint

Creating new Camel Projects

Importing into Eclipse

Existing Maven Project

Creating new Camel Projects

Testing Camel Projects








... from inside Eclipse

Agenda

History of Camel

What is Apache Camel?

A little Example

Riding Camel

What's in the Camel box?

Deploying Camel

Creating new Camel Projects

What's not in the Camel box?

More Information

What's not in the Camel box?

3rd party Apache Camel software

Commercial Supporthttp://camel.apache.org/commercial-camel-offerings.html

User Storieshttp://camel.apache.org/user-stories.html

External Componentshttp://camel.apache.org/components.html (bottom)

Apache Camel Extrahttps://code.google.com/a/apache-extras.org/p/camel-extra

What's not in the Camel box?

Tooling Eclipse Plugin Fuse IDE

http://github.com/fusesource/fuseide

What's not in the Camel box?

Tooling Web console - HawtIO

http://hawt.io

What's not in the Camel box?

Integration Platform

http://fabric8.io

Agenda

History of Camel

What is Apache Camel?

A little Example

Riding Camel

What's in the Camel box?

Deploying Camel

Creating new Camel Projects

What's not in the Camel box?

More Information

Where do I get more information?

Best Article covering what Apache Camel ishttp://java.dzone.com/articles/open-source-integration-apache

Link to article from Getting Started

Where do I get more information?

Try Camel Exampleshttp://camel.apache.org/examples.html

Read other blogs and articleshttp://camel.apache.org/articles.html

Use the search box on the Camel front page

Where do I get more information?

Use the mailing list / forumhttp://camel.apache.org/mailing-lists.html

Use stackoverflowhttp://stackoverflow.com/questions/tagged/apache-camel

Use IRC chathttp://camel.apache.org/irc-room.html

Where do I get more information?

Buy the Camel in Action book

http://manning.com/ibsen/

Use code ...camel40 for 40% discount

Where do I get more information?

.. and/or any of the other Camel books in the market

http://camel.apache.org/books

Where do I get more information?

Attend the CamelOne conferences

http://www.devnation.org

The conference formerly known as CamelOne,
is now part of larger conference named DevNation

Any Questions ?

ContactEMail: [email protected] / [email protected]

Twitter: @davsclaus

Blog: http://davsclaus.com

Linkedin: http://www.linkedin.com/in/davsclaus

Click to edit the title text format

Click to edit the outline text format

PUBLIC PRESENTATION | CLAUS IBSEN

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelEighth Outline LevelNinth Outline Level