SlideShare a Scribd company logo
1 of 74
Download to read offline
Claus Ibsen
Red Hat
●
Integration using
Apache Camel & Groovy
PUBLIC PRESENTATION | CLAUS IBSEN2
Your Speaker
● Principal Software Engineer at Red Hat
● Apache Camel
● 6 years as committer
● Author of Camel in Action book
● Contact
● EMail: claus.ibsen@gmail.com
● Twitter: @davsclaus
● Blog: http://davsclaus.com
● Linkedin: http://www.linkedin.com/in/davsclaus
PUBLIC PRESENTATION | CLAUS IBSEN3
This awesome ...
PUBLIC PRESENTATION | CLAUS IBSEN4
These two awesome has ...
PUBLIC PRESENTATION | CLAUS IBSEN5
These three awesome has ...
PUBLIC PRESENTATION | CLAUS IBSEN6
These three awesome has something in common
PUBLIC PRESENTATION | CLAUS IBSEN7
Agenda
● What is Apache Camel?
● A little Example
● Riding Camel
● Creating new Camel Projects
● hawtio
● Q & A
PUBLIC PRESENTATION | CLAUS IBSEN8
Why the name Camel?
PUBLIC PRESENTATION | CLAUS IBSEN9
Why the name Camel?
Because Camel is
easy to remember and type ...
PUBLIC PRESENTATION | CLAUS IBSEN10
Why the name Camel?
… or the creator used to smoke cigarets!
http://camel.apache.org/why-the-name-camel.html
PUBLIC PRESENTATION | CLAUS IBSEN11
What is Apache Camel?
● Quote from the website
PUBLIC PRESENTATION | CLAUS IBSEN12
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"
PUBLIC PRESENTATION | CLAUS IBSEN13
What is Apache Camel?
● What is Enterprise Integration Patterns?
It's a book
PUBLIC PRESENTATION | CLAUS IBSEN14
What is Apache Camel?
● Enterprise Integration Patterns
http://camel.apache.org/eip
PUBLIC PRESENTATION | CLAUS IBSEN15
What is Apache Camel?
● EIP - Content Based Router
PUBLIC PRESENTATION | CLAUS IBSEN16
What is Apache Camel?
from newOrder
PUBLIC PRESENTATION | CLAUS IBSEN17
What is Apache Camel?
from newOrder
choice
PUBLIC PRESENTATION | CLAUS IBSEN18
What is Apache Camel?
from newOrder
choice
when isWidget to widget
PUBLIC PRESENTATION | CLAUS IBSEN19
What is Apache Camel?
from newOrder
choice
when isWidget to widget
otherwise to gadget
PUBLIC PRESENTATION | CLAUS IBSEN20
What is Apache Camel?
from(newOrder)
choice
when(isWidget) to(widget)
otherwise to(gadget)
PUBLIC PRESENTATION | CLAUS IBSEN21
What is Apache Camel?
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget);
PUBLIC PRESENTATION | CLAUS IBSEN22
What is Apache Camel?
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget);
Ups Sorry ...
This is a gr8conf
so lets get Groovy :)
PUBLIC PRESENTATION | CLAUS IBSEN23
What is Apache Camel?
from newOrder
choice
when isWidget to widget
otherwise to gadget
PUBLIC PRESENTATION | CLAUS IBSEN24
What is Apache Camel?
from newOrder
choice
when isWidget to widget
otherwise to gadget
Unfortunately the Camel
Groovy DSL is not as
awesome …
yet
PUBLIC PRESENTATION | CLAUS IBSEN25
What is Apache Camel?
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget)
We removed that last semi colon ;)
PUBLIC PRESENTATION | CLAUS IBSEN26
What is Apache Camel?
Endpoint newOrder = endpoint("activemq:queue:newOrder");
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget);
PUBLIC PRESENTATION | CLAUS IBSEN27
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);
PUBLIC PRESENTATION | CLAUS IBSEN28
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);
PUBLIC PRESENTATION | CLAUS IBSEN29
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();
}
PUBLIC PRESENTATION | CLAUS IBSEN30
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();
}
}
PUBLIC PRESENTATION | CLAUS IBSEN31
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();
}
}
PUBLIC PRESENTATION | CLAUS IBSEN32
What is Apache Camel?
● Camel XML DSL
<route>
<from uri="activemq:queue:newOrder"/>
<choice>
<when>
<xpath>/order/product = 'widget'</xpath>
<to uri="activemq:queue:widget"/>
</when>
<otherwise>
<to uri="activemq:queue:gadget"/>
</otherwise>
</choice>
</route>
PUBLIC PRESENTATION | CLAUS IBSEN33
What is Apache Camel?
● Endpoint as URIs
<route>
<from uri="file:inbox/orders"/>
<choice>
<when>
<xpath>/order/product = 'widget'</xpath>
<to uri="activemq:queue:widget"/>
</when>
<otherwise>
<to uri="activemq:queue:gadget"/>
</otherwise>
</choice>
</route>
use file instead
PUBLIC PRESENTATION | CLAUS IBSEN34
What is Apache Camel?
● Endpoint as URIs
<route>
<from uri="file:inbox/orders?delete=true"/>
<choice>
<when>
<xpath>/order/product = 'widget'</xpath>
<to uri="activemq:queue:widget"/>
</when>
<otherwise>
<to uri="activemq:queue:gadget"/>
</otherwise>
</choice>
</route>
parameters
PUBLIC PRESENTATION | CLAUS IBSEN35
Standard Java, XML, or Groovy
● Java DSL is just Java
PUBLIC PRESENTATION | CLAUS IBSEN36
Standard Java, XML, or Groovy
● XML DSL is just XML
● … with XSD schema for validation/tooling
PUBLIC PRESENTATION | CLAUS IBSEN37
Standard Java, XML, or Groovy
● Groovy DSL is just Groovy
Groovy
Closure
PUBLIC PRESENTATION | CLAUS IBSEN38
What is Apache Camel?
● Camel's Architecture
PUBLIC PRESENTATION | CLAUS IBSEN39
What is Apache Camel?
150+ Components
PUBLIC PRESENTATION | CLAUS IBSEN40
What is Apache Camel?
150+ Components
PUBLIC PRESENTATION | CLAUS IBSEN41
What is Apache Camel?
● Summary
● Integration Framework
● Enterprise Integration Patterns (EIP)
● Routing (using DSL)
● Easy Configuration (endpoint as uri's)
● Just Java, XML, or Groovy code
● No Container Dependency
● A lot of components
PUBLIC PRESENTATION | CLAUS IBSEN42
Agenda
● What is Apache Camel?
● A little Example
● Riding Camel
● Creating new Camel Projects
● hawtio
● Q & A
PUBLIC PRESENTATION | CLAUS IBSEN43
A Little Example
● File Copier Example
PUBLIC PRESENTATION | CLAUS IBSEN44
A Little Example
● File Copier Example
PUBLIC PRESENTATION | CLAUS IBSEN45
A Little Example
● File Copier Example
PUBLIC PRESENTATION | CLAUS IBSEN46
A Little Example
● File Copier Example
PUBLIC PRESENTATION | CLAUS IBSEN47
A Little Example
● File Copier Example
PUBLIC PRESENTATION | CLAUS IBSEN48
A Little Groovy Example
PUBLIC PRESENTATION | CLAUS IBSEN49
A Little Groovy Example (all source)
PUBLIC PRESENTATION | CLAUS IBSEN50
A Little Groovy Example
● Run the example
● groovy mycamel.groovy
PUBLIC PRESENTATION | CLAUS IBSEN51
Agenda
● What is Apache Camel?
● A little Example
● Riding Camel
● Creating new Camel Projects
● hawtio
● Q & A
PUBLIC PRESENTATION | CLAUS IBSEN52
Riding Camel
● Downloading Apache Camel
● zip/tarball (approx 8mb)
http://camel.apache.org
PUBLIC PRESENTATION | CLAUS IBSEN53
Riding Camel
● Using Command Shell
● Requires: Apache Maven
● From Eclipse
PUBLIC PRESENTATION | CLAUS IBSEN54
Riding Camel
● Console Example
● cd examples/camel-example-console
● mvn compile exec:java
PUBLIC PRESENTATION | CLAUS IBSEN55
Riding Camel
● Twitter Example
● cd examples/camel-example-twitter-websocket
● mvn compile exec:java http://localhost:9090/index.html
PUBLIC PRESENTATION | CLAUS IBSEN56
Riding Camel
● More examples ...
... and further details at website.
http://camel.apache.org/examples
PUBLIC PRESENTATION | CLAUS IBSEN57
Agenda
● What is Apache Camel?
● A little Example
● Riding Camel
● Creating new Camel Projects
● hawtio
● Q & A
PUBLIC PRESENTATION | CLAUS IBSEN58
Creating new Camel Projects
● Using Command Shell
● .. or from Eclipse
PUBLIC PRESENTATION | CLAUS IBSEN59
Creating new Camel Projects
● Importing into Eclipse
Existing Maven Project
PUBLIC PRESENTATION | CLAUS IBSEN60
Creating new Camel Projects
● Maven Archetypes
camel-archetype-activemq camel-archetype-java
camel-archetype-blueprint camel-archetype-scala
camel-archetype-component camel-archetype-spring
camel-archetype-dataformat camel-archetype-spring-dm
camel-archetype-groovy camel-archetype-web
PUBLIC PRESENTATION | CLAUS IBSEN61
Creating new Camel Projects
● camel-archetype-groovy
mvn install
mvn exec:java
PUBLIC PRESENTATION | CLAUS IBSEN62
Creating new Camel Projects
● camel-archetype-spring
mvn install
mvn camel:run
mvn io.hawt:hawtio-maven-plugin:1.4.2:spring
PUBLIC PRESENTATION | CLAUS IBSEN63
Agenda
● What is Apache Camel?
● A little Example
● Riding Camel
● Creating new Camel Projects
● hawtio
● Q & A
PUBLIC PRESENTATION | CLAUS IBSEN64
hawtio
● What does it do? ...
PUBLIC PRESENTATION | CLAUS IBSEN65
hawtio
● Yet another awesome project created by this guy ...
PUBLIC PRESENTATION | CLAUS IBSEN66
hawtio
Tooling – Web Console - hawtio
http://hawt.io
PUBLIC PRESENTATION | CLAUS IBSEN67
hawtio
● What does it do
for Apache Camel?
PUBLIC PRESENTATION | CLAUS IBSEN68
hawtio
● Technology Stack
● HTML5 single page app
● TypeScript → JavaScript
● Angular JS
● Bootstrap CSS
● HTTP/REST ↔ backend
● Jolokia on backend for JMX over REST
● Plugins expose services as JMX or REST
http://hawt.io/plugins/howPluginsWork.html
PUBLIC PRESENTATION | CLAUS IBSEN69
Apache Camel & hawtio
PUBLIC PRESENTATION | CLAUS IBSEN70
Agenda
● What is Apache Camel?
● A little Example
● Riding Camel
● Creating new Camel Projects
● hawtio
● Q & A
PUBLIC PRESENTATION | CLAUS IBSEN71
These three awesome has something in common
PUBLIC PRESENTATION | CLAUS IBSEN72
These three awesome has something in common
PUBLIC PRESENTATION | CLAUS IBSEN73
What about a 4th
awesome project?
PUBLIC PRESENTATION | CLAUS IBSEN74
Any Questions ?
● Contact
● EMail: cibsen@redhat.com / claus.ibsen@gmail.com
● Twitter: @davsclaus
● Blog: http://davsclaus.com
● Linkedin: http://www.linkedin.com/in/davsclaus

More Related Content

What's hot

Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"
Fwdays
 
Andrew Mykhaliuk - Sorry, I need to make a build for frontend
Andrew Mykhaliuk - Sorry, I need to make a build for frontendAndrew Mykhaliuk - Sorry, I need to make a build for frontend
Andrew Mykhaliuk - Sorry, I need to make a build for frontend
OdessaJS Conf
 

What's hot (20)

DevOps with Serverless
DevOps with ServerlessDevOps with Serverless
DevOps with Serverless
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
 
A web app in pure Clojure
A web app in pure ClojureA web app in pure Clojure
A web app in pure Clojure
 
Blackfire.io PHPVigo Talk
Blackfire.io PHPVigo TalkBlackfire.io PHPVigo Talk
Blackfire.io PHPVigo Talk
 
Writing Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScriptWriting Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScript
 
Testing Mobile JavaScript
Testing Mobile JavaScriptTesting Mobile JavaScript
Testing Mobile JavaScript
 
Testing Angular Applications - Jfokus 2017
Testing Angular Applications - Jfokus 2017Testing Angular Applications - Jfokus 2017
Testing Angular Applications - Jfokus 2017
 
Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"
 
Building Efficient and Reliable Crawler System With Sidekiq Enterprise
Building Efficient and Reliable Crawler System With Sidekiq EnterpriseBuilding Efficient and Reliable Crawler System With Sidekiq Enterprise
Building Efficient and Reliable Crawler System With Sidekiq Enterprise
 
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
 
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
 
SOAP calls in Clojure application
SOAP calls in Clojure applicationSOAP calls in Clojure application
SOAP calls in Clojure application
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
 
Next-Generation Ruby Deployment with Heroku
Next-Generation Ruby Deployment with HerokuNext-Generation Ruby Deployment with Heroku
Next-Generation Ruby Deployment with Heroku
 
Puppet Camp London Fall 2015 - Service Discovery and Puppet
Puppet Camp London Fall 2015 - Service Discovery and PuppetPuppet Camp London Fall 2015 - Service Discovery and Puppet
Puppet Camp London Fall 2015 - Service Discovery and Puppet
 
Madison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsMadison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small Teams
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Rich Web Experie...
 
Reactive microservices with Micronaut - Greach 2018
Reactive microservices with Micronaut - Greach 2018Reactive microservices with Micronaut - Greach 2018
Reactive microservices with Micronaut - Greach 2018
 
mykola marzhan - jenkins on aws spot instance
mykola marzhan - jenkins on aws spot instancemykola marzhan - jenkins on aws spot instance
mykola marzhan - jenkins on aws spot instance
 
Andrew Mykhaliuk - Sorry, I need to make a build for frontend
Andrew Mykhaliuk - Sorry, I need to make a build for frontendAndrew Mykhaliuk - Sorry, I need to make a build for frontend
Andrew Mykhaliuk - Sorry, I need to make a build for frontend
 

Viewers also liked (6)

Egypt holiday travel (pps sample)
Egypt holiday travel (pps sample)Egypt holiday travel (pps sample)
Egypt holiday travel (pps sample)
 
Camels rating system
Camels rating systemCamels rating system
Camels rating system
 
Spring IO '15 - Developing microservices, Spring Boot or Grails?
Spring IO '15 - Developing microservices, Spring Boot or Grails?Spring IO '15 - Developing microservices, Spring Boot or Grails?
Spring IO '15 - Developing microservices, Spring Boot or Grails?
 
Say No Thank You to the PowerPoint Thank You Slide
Say No Thank You to the PowerPoint Thank You SlideSay No Thank You to the PowerPoint Thank You Slide
Say No Thank You to the PowerPoint Thank You Slide
 
Camel ratings ppt
Camel ratings pptCamel ratings ppt
Camel ratings ppt
 
Camels Rating
Camels RatingCamels Rating
Camels Rating
 

Similar to Integration using Apache Camel and Groovy

Using Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivityUsing Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivity
Claus Ibsen
 

Similar to Integration using Apache Camel and Groovy (20)

Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
 
Getting started with Apache Camel - May 2013
Getting started with Apache Camel - May 2013Getting started with Apache Camel - May 2013
Getting started with Apache Camel - May 2013
 
Getting Started with Apache Camel - Devconf Conference - February 2013
Getting Started with Apache Camel - Devconf Conference - February 2013Getting Started with Apache Camel - Devconf Conference - February 2013
Getting Started with Apache Camel - Devconf Conference - February 2013
 
Getting Started with Apache Camel - Malmo JUG - March 2013
Getting Started with Apache Camel - Malmo JUG - March 2013Getting Started with Apache Camel - Malmo JUG - March 2013
Getting Started with Apache Camel - Malmo JUG - March 2013
 
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014Getting started with Apache Camel - Javagruppen Copenhagen - April 2014
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014
 
Getting started with Apache Camel - jDays 2013
Getting started with Apache Camel - jDays 2013Getting started with Apache Camel - jDays 2013
Getting started with Apache Camel - jDays 2013
 
Microservices with apache_camel_barcelona
Microservices with apache_camel_barcelonaMicroservices with apache_camel_barcelona
Microservices with apache_camel_barcelona
 
Microservices with Apache Camel
Microservices with Apache CamelMicroservices with Apache Camel
Microservices with Apache Camel
 
Getting Started with Apache Camel at DevNation 2014
Getting Started with Apache Camel at DevNation 2014Getting Started with Apache Camel at DevNation 2014
Getting Started with Apache Camel at DevNation 2014
 
Developing Microservices with Apache Camel
Developing Microservices with Apache CamelDeveloping Microservices with Apache Camel
Developing Microservices with Apache Camel
 
Integrating microservices with apache camel on kubernetes
Integrating microservices with apache camel on kubernetesIntegrating microservices with apache camel on kubernetes
Integrating microservices with apache camel on kubernetes
 
Using Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivityUsing Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivity
 
Apache Camel workshop at BarcelonaJUG in January 2014
Apache Camel workshop at BarcelonaJUG in January 2014Apache Camel workshop at BarcelonaJUG in January 2014
Apache Camel workshop at BarcelonaJUG in January 2014
 
Container Camp London (2016-09-09)
Container Camp London (2016-09-09)Container Camp London (2016-09-09)
Container Camp London (2016-09-09)
 
Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache Camel
 
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes][HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]
 
Graph ql subscriptions through the looking glass
Graph ql subscriptions through the looking glassGraph ql subscriptions through the looking glass
Graph ql subscriptions through the looking glass
 
Introduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud RunIntroduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud Run
 
AllDayDevOps ZAP automation in CI
AllDayDevOps ZAP automation in CIAllDayDevOps ZAP automation in CI
AllDayDevOps ZAP automation in CI
 
Running Containerized Node.js Services on AWS Elastic Beanstalk
Running Containerized Node.js Services on AWS Elastic BeanstalkRunning Containerized Node.js Services on AWS Elastic Beanstalk
Running Containerized Node.js Services on AWS Elastic Beanstalk
 

More from GR8Conf

More from GR8Conf (20)

DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your Team
 
Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle
 
Mum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerMum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developer
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with Groovy
 
Scraping with Geb
Scraping with GebScraping with Geb
Scraping with Geb
 
How to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidHow to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and Android
 
Ratpack On the Docks
Ratpack On the DocksRatpack On the Docks
Ratpack On the Docks
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
 
Cut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsCut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature plugins
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applications
 
Ratpack and Grails 3
 Ratpack and Grails 3 Ratpack and Grails 3
Ratpack and Grails 3
 
Grails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGrails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloud
 
Functional testing your Grails app with GEB
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEB
 
Deploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCDeploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPC
 
The Grails introduction workshop
The Grails introduction workshopThe Grails introduction workshop
The Grails introduction workshop
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spock
 
The Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedThe Groovy Ecosystem Revisited
The Groovy Ecosystem Revisited
 
Groovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGroovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examples
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
 
Grooscript gr8conf
Grooscript gr8confGrooscript gr8conf
Grooscript gr8conf
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Integration using Apache Camel and Groovy

  • 1. Claus Ibsen Red Hat ● Integration using Apache Camel & Groovy
  • 2. PUBLIC PRESENTATION | CLAUS IBSEN2 Your Speaker ● Principal Software Engineer at Red Hat ● Apache Camel ● 6 years as committer ● Author of Camel in Action book ● Contact ● EMail: claus.ibsen@gmail.com ● Twitter: @davsclaus ● Blog: http://davsclaus.com ● Linkedin: http://www.linkedin.com/in/davsclaus
  • 3. PUBLIC PRESENTATION | CLAUS IBSEN3 This awesome ...
  • 4. PUBLIC PRESENTATION | CLAUS IBSEN4 These two awesome has ...
  • 5. PUBLIC PRESENTATION | CLAUS IBSEN5 These three awesome has ...
  • 6. PUBLIC PRESENTATION | CLAUS IBSEN6 These three awesome has something in common
  • 7. PUBLIC PRESENTATION | CLAUS IBSEN7 Agenda ● What is Apache Camel? ● A little Example ● Riding Camel ● Creating new Camel Projects ● hawtio ● Q & A
  • 8. PUBLIC PRESENTATION | CLAUS IBSEN8 Why the name Camel?
  • 9. PUBLIC PRESENTATION | CLAUS IBSEN9 Why the name Camel? Because Camel is easy to remember and type ...
  • 10. PUBLIC PRESENTATION | CLAUS IBSEN10 Why the name Camel? … or the creator used to smoke cigarets! http://camel.apache.org/why-the-name-camel.html
  • 11. PUBLIC PRESENTATION | CLAUS IBSEN11 What is Apache Camel? ● Quote from the website
  • 12. PUBLIC PRESENTATION | CLAUS IBSEN12 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"
  • 13. PUBLIC PRESENTATION | CLAUS IBSEN13 What is Apache Camel? ● What is Enterprise Integration Patterns? It's a book
  • 14. PUBLIC PRESENTATION | CLAUS IBSEN14 What is Apache Camel? ● Enterprise Integration Patterns http://camel.apache.org/eip
  • 15. PUBLIC PRESENTATION | CLAUS IBSEN15 What is Apache Camel? ● EIP - Content Based Router
  • 16. PUBLIC PRESENTATION | CLAUS IBSEN16 What is Apache Camel? from newOrder
  • 17. PUBLIC PRESENTATION | CLAUS IBSEN17 What is Apache Camel? from newOrder choice
  • 18. PUBLIC PRESENTATION | CLAUS IBSEN18 What is Apache Camel? from newOrder choice when isWidget to widget
  • 19. PUBLIC PRESENTATION | CLAUS IBSEN19 What is Apache Camel? from newOrder choice when isWidget to widget otherwise to gadget
  • 20. PUBLIC PRESENTATION | CLAUS IBSEN20 What is Apache Camel? from(newOrder) choice when(isWidget) to(widget) otherwise to(gadget)
  • 21. PUBLIC PRESENTATION | CLAUS IBSEN21 What is Apache Camel? from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
  • 22. PUBLIC PRESENTATION | CLAUS IBSEN22 What is Apache Camel? from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget); Ups Sorry ... This is a gr8conf so lets get Groovy :)
  • 23. PUBLIC PRESENTATION | CLAUS IBSEN23 What is Apache Camel? from newOrder choice when isWidget to widget otherwise to gadget
  • 24. PUBLIC PRESENTATION | CLAUS IBSEN24 What is Apache Camel? from newOrder choice when isWidget to widget otherwise to gadget Unfortunately the Camel Groovy DSL is not as awesome … yet
  • 25. PUBLIC PRESENTATION | CLAUS IBSEN25 What is Apache Camel? from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget) We removed that last semi colon ;)
  • 26. PUBLIC PRESENTATION | CLAUS IBSEN26 What is Apache Camel? Endpoint newOrder = endpoint("activemq:queue:newOrder"); from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
  • 27. PUBLIC PRESENTATION | CLAUS IBSEN27 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);
  • 28. PUBLIC PRESENTATION | CLAUS IBSEN28 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);
  • 29. PUBLIC PRESENTATION | CLAUS IBSEN29 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(); }
  • 30. PUBLIC PRESENTATION | CLAUS IBSEN30 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(); } }
  • 31. PUBLIC PRESENTATION | CLAUS IBSEN31 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(); } }
  • 32. PUBLIC PRESENTATION | CLAUS IBSEN32 What is Apache Camel? ● Camel XML DSL <route> <from uri="activemq:queue:newOrder"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:queue:widget"/> </when> <otherwise> <to uri="activemq:queue:gadget"/> </otherwise> </choice> </route>
  • 33. PUBLIC PRESENTATION | CLAUS IBSEN33 What is Apache Camel? ● Endpoint as URIs <route> <from uri="file:inbox/orders"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:queue:widget"/> </when> <otherwise> <to uri="activemq:queue:gadget"/> </otherwise> </choice> </route> use file instead
  • 34. PUBLIC PRESENTATION | CLAUS IBSEN34 What is Apache Camel? ● Endpoint as URIs <route> <from uri="file:inbox/orders?delete=true"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:queue:widget"/> </when> <otherwise> <to uri="activemq:queue:gadget"/> </otherwise> </choice> </route> parameters
  • 35. PUBLIC PRESENTATION | CLAUS IBSEN35 Standard Java, XML, or Groovy ● Java DSL is just Java
  • 36. PUBLIC PRESENTATION | CLAUS IBSEN36 Standard Java, XML, or Groovy ● XML DSL is just XML ● … with XSD schema for validation/tooling
  • 37. PUBLIC PRESENTATION | CLAUS IBSEN37 Standard Java, XML, or Groovy ● Groovy DSL is just Groovy Groovy Closure
  • 38. PUBLIC PRESENTATION | CLAUS IBSEN38 What is Apache Camel? ● Camel's Architecture
  • 39. PUBLIC PRESENTATION | CLAUS IBSEN39 What is Apache Camel? 150+ Components
  • 40. PUBLIC PRESENTATION | CLAUS IBSEN40 What is Apache Camel? 150+ Components
  • 41. PUBLIC PRESENTATION | CLAUS IBSEN41 What is Apache Camel? ● Summary ● Integration Framework ● Enterprise Integration Patterns (EIP) ● Routing (using DSL) ● Easy Configuration (endpoint as uri's) ● Just Java, XML, or Groovy code ● No Container Dependency ● A lot of components
  • 42. PUBLIC PRESENTATION | CLAUS IBSEN42 Agenda ● What is Apache Camel? ● A little Example ● Riding Camel ● Creating new Camel Projects ● hawtio ● Q & A
  • 43. PUBLIC PRESENTATION | CLAUS IBSEN43 A Little Example ● File Copier Example
  • 44. PUBLIC PRESENTATION | CLAUS IBSEN44 A Little Example ● File Copier Example
  • 45. PUBLIC PRESENTATION | CLAUS IBSEN45 A Little Example ● File Copier Example
  • 46. PUBLIC PRESENTATION | CLAUS IBSEN46 A Little Example ● File Copier Example
  • 47. PUBLIC PRESENTATION | CLAUS IBSEN47 A Little Example ● File Copier Example
  • 48. PUBLIC PRESENTATION | CLAUS IBSEN48 A Little Groovy Example
  • 49. PUBLIC PRESENTATION | CLAUS IBSEN49 A Little Groovy Example (all source)
  • 50. PUBLIC PRESENTATION | CLAUS IBSEN50 A Little Groovy Example ● Run the example ● groovy mycamel.groovy
  • 51. PUBLIC PRESENTATION | CLAUS IBSEN51 Agenda ● What is Apache Camel? ● A little Example ● Riding Camel ● Creating new Camel Projects ● hawtio ● Q & A
  • 52. PUBLIC PRESENTATION | CLAUS IBSEN52 Riding Camel ● Downloading Apache Camel ● zip/tarball (approx 8mb) http://camel.apache.org
  • 53. PUBLIC PRESENTATION | CLAUS IBSEN53 Riding Camel ● Using Command Shell ● Requires: Apache Maven ● From Eclipse
  • 54. PUBLIC PRESENTATION | CLAUS IBSEN54 Riding Camel ● Console Example ● cd examples/camel-example-console ● mvn compile exec:java
  • 55. PUBLIC PRESENTATION | CLAUS IBSEN55 Riding Camel ● Twitter Example ● cd examples/camel-example-twitter-websocket ● mvn compile exec:java http://localhost:9090/index.html
  • 56. PUBLIC PRESENTATION | CLAUS IBSEN56 Riding Camel ● More examples ... ... and further details at website. http://camel.apache.org/examples
  • 57. PUBLIC PRESENTATION | CLAUS IBSEN57 Agenda ● What is Apache Camel? ● A little Example ● Riding Camel ● Creating new Camel Projects ● hawtio ● Q & A
  • 58. PUBLIC PRESENTATION | CLAUS IBSEN58 Creating new Camel Projects ● Using Command Shell ● .. or from Eclipse
  • 59. PUBLIC PRESENTATION | CLAUS IBSEN59 Creating new Camel Projects ● Importing into Eclipse Existing Maven Project
  • 60. PUBLIC PRESENTATION | CLAUS IBSEN60 Creating new Camel Projects ● Maven Archetypes camel-archetype-activemq camel-archetype-java camel-archetype-blueprint camel-archetype-scala camel-archetype-component camel-archetype-spring camel-archetype-dataformat camel-archetype-spring-dm camel-archetype-groovy camel-archetype-web
  • 61. PUBLIC PRESENTATION | CLAUS IBSEN61 Creating new Camel Projects ● camel-archetype-groovy mvn install mvn exec:java
  • 62. PUBLIC PRESENTATION | CLAUS IBSEN62 Creating new Camel Projects ● camel-archetype-spring mvn install mvn camel:run mvn io.hawt:hawtio-maven-plugin:1.4.2:spring
  • 63. PUBLIC PRESENTATION | CLAUS IBSEN63 Agenda ● What is Apache Camel? ● A little Example ● Riding Camel ● Creating new Camel Projects ● hawtio ● Q & A
  • 64. PUBLIC PRESENTATION | CLAUS IBSEN64 hawtio ● What does it do? ...
  • 65. PUBLIC PRESENTATION | CLAUS IBSEN65 hawtio ● Yet another awesome project created by this guy ...
  • 66. PUBLIC PRESENTATION | CLAUS IBSEN66 hawtio Tooling – Web Console - hawtio http://hawt.io
  • 67. PUBLIC PRESENTATION | CLAUS IBSEN67 hawtio ● What does it do for Apache Camel?
  • 68. PUBLIC PRESENTATION | CLAUS IBSEN68 hawtio ● Technology Stack ● HTML5 single page app ● TypeScript → JavaScript ● Angular JS ● Bootstrap CSS ● HTTP/REST ↔ backend ● Jolokia on backend for JMX over REST ● Plugins expose services as JMX or REST http://hawt.io/plugins/howPluginsWork.html
  • 69. PUBLIC PRESENTATION | CLAUS IBSEN69 Apache Camel & hawtio
  • 70. PUBLIC PRESENTATION | CLAUS IBSEN70 Agenda ● What is Apache Camel? ● A little Example ● Riding Camel ● Creating new Camel Projects ● hawtio ● Q & A
  • 71. PUBLIC PRESENTATION | CLAUS IBSEN71 These three awesome has something in common
  • 72. PUBLIC PRESENTATION | CLAUS IBSEN72 These three awesome has something in common
  • 73. PUBLIC PRESENTATION | CLAUS IBSEN73 What about a 4th awesome project?
  • 74. PUBLIC PRESENTATION | CLAUS IBSEN74 Any Questions ? ● Contact ● EMail: cibsen@redhat.com / claus.ibsen@gmail.com ● Twitter: @davsclaus ● Blog: http://davsclaus.com ● Linkedin: http://www.linkedin.com/in/davsclaus