getting started with apache camel at devnation 2014

Download Getting Started with Apache Camel at DevNation 2014

If you can't read please download the document

Upload: claus-ibsen

Post on 16-Apr-2017

2.449 views

Category:

Software


1 download

TRANSCRIPT

Getting started with
Apache Camel

Claus Ibsen
@davsclaus

Agenda

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 as committer

Author of Camel in Action book

ContactEMail: [email protected]

Twitter: @davsclaus

Blog: http://davsclaus.com

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

My Camel Story

Starts 7 years ago

Consultant working for Silverbullet

POC in 2007/2008

Looking foropen source

Integration framework

As replacement for aging Integration Platform

Apache Camel was one of the candidates

My Camel Story

Apache Camel 1.2 had missing parts








.. so I had to add those missing parts

My Camel Story

.. to turn Camel into the lovely Camel
it could be back.








It was a success as our 1st Apache Camel 1.x integration went into production end of 2008.

Agenda

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

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

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

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?

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?

4 DSL in multiple languagesJava DSL

XML DSL (Spring and OSGi Blueprint)

Groovy DSL

Scala DSL

What's in the box?

Test Kitcamel-testcamel-test-spring

camel-test-blueprintcamel-testng

What's in the box?

ManagementJMX

REST (w/ Jolokia)

Agenda

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

Known ContainersApache ActiveMQApache KarafApache ServiceMixApache TomcatFabric8GlassfishJBoss AS / WildflyJBoss FuseJBoss Fuse Service WorksJettyWebLogicWebSphere

Known CloudsAmazon EC2Google App EngineOpenStackOpenShift

and many more

Camel as a Client

Java Client Application (no routes)

ExampleUpload a file to a FTP server

Agenda

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



.. or from Eclipse

Creating new Camel Projects

Importing into Eclipse

Existing Maven Project

Creating new Camel Projects

Maven Archetypes

camel-archetype-activemqcamel-archetype-java

camel-archetype-blueprintcamel-archetype-scala

camel-archetype-componentcamel-archetype-spring

camel-archetype-dataformatcamel-archetype-spring-dm

camel-archetype-groovycamel-archetype-web

Creating new Camel Projects

camel-archetype-spring

mvn installmvn camel:runmvn io.hawt:hawtio-maven-plugin:1.3.1:spring

Agenda

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

Free community and Red Hat supported versions at:http://tools.jboss.org/downloads/

What's not in the Camel box?

Tooling Web Console - hawtio

http://hawt.io

What's not in the Camel box?

Integration Platform - fabric8

http://fabric8.io

Agenda

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

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

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