SlideShare a Scribd company logo
1 of 101
Microservices with Apache Camel
Claus Ibsen (@davsclaus)
Principal Software Engineer, Red Hat
Your Speaker
Your Speaker
● Principal Software Engineer at Red Hat
● Apache Camel
● 7 years working with Camel
● Author of Camel in Action books
● Contact
● E-mail: cibsen@redhat.com
● Twitter: @davsclaus
● Blog: http://davsclaus.com
Shameful Advertisement
http://manning.com/ibsen2
Coupon Code
(39% discount)
camel39
Agenda
● What is Apache Camel?
● Camel Microservices
● Demo
● Standalone
● with Docker
● with OpenShift 3 / Kubernetes
● More Information
What is Apache Camel?
● Quote from the website
What is Apache Camel?
● Integration Framework
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
<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>
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
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
What is Apache Camel?
● Java DSL is just Java
What is Apache Camel?
● 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
+
+
+
+
+
+
=
+
+
+
Agenda
● What is Apache Camel?
● Camel Microservices
● Demo
● Standalone
● with Docker
● with OpenShift 3 / Kubernetes
● More Information
Running Camel as Microservices
Standalone Web Application
Camel Spring XML Apache Karaf
Camel Spring Boot Wildfly (wildfly-camel)
Camel CDI vert.x (vertx-camel)
Camel Guice Rest DSL
Camel Microservices
● Apache Karaf
Camel Microservices
● Apache Karaf
Apache Karaf
(boot)
Camel Microservices
● Apache Karaf
Karaf Features
OSGi Bundles
Apache Karaf
(boot)
Camel Microservices
● Apache Karaf
Karaf Features
OSGi Bundles
Apache Karaf
(boot)
Karaf Maven
Plugin
Camel Microservices
● Apache Karaf
Karaf Features
OSGi Bundles
Apache Karaf
(boot)
Karaf Maven
Plugin
Custom Karaf
(with your app)
tar / zip file
Camel Microservices
● Rest DSL
● Use Rest verbs
GET
POST
PUT
...
● Swagger API
● Pluggable Transport
Rest DSL example
Rest DSL example
Rest DSL example
Rest DSL example - add Swagger API
Agenda
● What is Apache Camel?
● Camel Microservices
● Demo
● Hello Service
● Create the Camel projects
● Docker
● OpenShift v3
● More Information
Demo - Hello Service
Hello Service
Demo - Hello Service
Hello Service
Hi I am New York. Hello Claus how are you today?
name=Claus
Demo - Hello Service
Java Standalone Apache Tomcat
HTTP
Hello Service
Demo - Hello Service
Java Standalone Apache Tomcat
HTTP
from timer
to http
to log
from servlet
transform
Hello Service
Demo - Create the Camel Projects
Java Standalone Apache Tomcat
HTTP
from timer
to http
to log
from servlet
transform
Hello Service
camel-archetype-cdi camel-archetype-web
Demo - Create the Camel Projects
● Using Command Shell
● From Eclipse
Demo - Create the Camel Projects
● camel-archetype-web
Ready to use
out of the box
Demo - Create the Camel Projects
● camel-archetype-cdi
Not ready
We need to change
he code
Demo - Create the Camel Projects
● add netty4-http endpoint
CMD + ALT
4
Demo - Create the Camel Projects
● configure netty4-http endpoint
Demo - Create the Camel Projects
● change route to call netty
Demo - Create the Camel Projects
● change bean to return a name
Demo - Overview
● camel-archetype-cdi camel-archetype-web
Java Standalone Apache Tomcat
HTTP 8080
from timer
to http
to log
from http
transform
We are ready to run standalone
Demo - Running Standalone
mvn camel:run
Agenda
● What is Apache Camel?
● Camel Microservices
● Demo
● Hello Service
● Create the Camel projects
● Docker
● OpenShift v3
● More Information
Camel and Docker
Maven Project
Docker Maven
Plugin
Docker Image
build
Add Docker from Command Line
Add Docker from Eclipse / IDEA CMD + ALT
4
Docker Maven Plugin in pom.xml
Build Docker Containers
● mvn clean install docker:build
Build Docker Containers
● After build images in local Docker repository
camel-archetype-cdi
camel-archetype-web
Agenda
● What is Apache Camel?
● Camel Microservices
● Demo
● Hello Service
● Create the Camel projects
● Docker
● OpenShift v3
● More Information
Static
● camel-archetype-cdi camel-archetype-web
Java Standalone Apache Tomcat
from timer
to http
to log
from servlet
transform
HTTP 8080
hostname:port
is static / hardcoded
Dynamic
● camel-archetype-cdi camel-archetype-web
Java Standalone Apache Tomcat
from timer
to http
to log
from servlet
transform
Service
Kubernetes
Service
What is a Kubernetes Service
● Network Connection to one or more Pods
● Own fixed IP address and port
http://fabric8.io/guide/services.html
http://kubernetes.io/v1.1/docs/user-guide/services.html
What is a Kubernetes Service
● kube-proxy on client
http://fabric8.io/guide/services.html
http://kubernetes.io/v1.1/docs/user-guide/services.html
Java Standalone Apache Tomcat
from timer
to http
to log
from servlet
transform
kube-proxy
Kubernetes
Master
service
changes
Service
enlist
Define Kubernetes Service
● Use fabric8
command
Apache Tomcat
from servlet
transform
Service
Define Kubernetes Service
● Defined in pom.xml in <properties>
Apache Tomcat
from servlet
transform
Service
Container Port = Inside Docker Container
(e.g. the port of Apache Tomcat)
Service Port = Outside
Consumers of Service to use
Name of service
Generated kubernetes.json
Apache Tomcat
from http
choice
setBody
Service
Use Kubernetes Services
Java Standalone
from timer
to http
to log
● Environment Variables
● Hostname
● Port
Injected by Kubernetes
when starting a pod
Camel - Use Kubernetes Service
● Use {{service:name}} in Camel
Java Standalone
from timer
to http
to log
Microservice Demo - Ready for launch!
● camel-archetype-cdi camel-archetype-web
Java Standalone Apache Tomcat
from timer
to http
to log
from http
transform
Service
Service defined
Ready to deploy to Kubernetes
Deploy - myweb
● mvn -Pf8-local-deploy
Apache Tomcat
from http
transform
Service
Deploy - camel-archetype-cdi
● mvn -Pf8-local-deploy
Java Standalone
from timer
to http
to log
fabric8 web console
● http://fabric8.vagrant.f8
OpenShift 3 CLI
● oc get pods
docker CLI is also possible
docker images
docker ps
OpenShift 3 CLI
● oc get services
OpenShift 3 CLI
● oc logs -f <pod-name>
OpenShift 3 CLI
● oc get routes
Scaling up / down
● change controller replicas
Scaling up / down
● Service Load Balancing
Agenda
● What is Apache Camel?
● Camel Microservices
● Demo
● Hello Service
● Create the Camel projects
● Docker
● OpenShift v3
● More Information
More information
● Apache Camel Microservices
● http://camel.apache.org/camel-boot
● Fabric8
● http://fabric8.io
● chat room #fabric8 on freenode
● Medium Fabric8 (blogs and videos)
● https://medium.com/fabric8-io

More Related Content

What's hot

What's hot (20)

Best Practices for Middleware and Integration Architecture Modernization with...
Best Practices for Middleware and Integration Architecture Modernization with...Best Practices for Middleware and Integration Architecture Modernization with...
Best Practices for Middleware and Integration Architecture Modernization with...
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as Code
 
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Kubernetes Probes (Liveness, Readyness, Startup) Introduction
Kubernetes Probes (Liveness, Readyness, Startup) IntroductionKubernetes Probes (Liveness, Readyness, Startup) Introduction
Kubernetes Probes (Liveness, Readyness, Startup) Introduction
 
Spring boot
Spring bootSpring boot
Spring boot
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 Workshop
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Common issues with Apache Kafka® Producer
Common issues with Apache Kafka® ProducerCommon issues with Apache Kafka® Producer
Common issues with Apache Kafka® Producer
 
Docker intro
Docker introDocker intro
Docker intro
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
SQL on everything, in memory
SQL on everything, in memorySQL on everything, in memory
SQL on everything, in memory
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Serverless integration with Knative and Apache Camel on Kubernetes
Serverless integration with Knative and Apache Camel on KubernetesServerless integration with Knative and Apache Camel on Kubernetes
Serverless integration with Knative and Apache Camel on Kubernetes
 
What is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | EdurekaWhat is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | Edureka
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Building an Event Streaming Architecture with Apache Pulsar
Building an Event Streaming Architecture with Apache PulsarBuilding an Event Streaming Architecture with Apache Pulsar
Building an Event Streaming Architecture with Apache Pulsar
 
Java Spring
Java SpringJava Spring
Java Spring
 

Viewers also liked

Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
FuseSource.com
 

Viewers also liked (6)

Realtime analytics with Flink and Druid
Realtime analytics with Flink and DruidRealtime analytics with Flink and Druid
Realtime analytics with Flink and Druid
 
Microservices with Apache Camel
Microservices with Apache CamelMicroservices with Apache Camel
Microservices with Apache Camel
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
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
 
Apache Camel - The integration library
Apache Camel - The integration libraryApache Camel - The integration library
Apache Camel - The integration library
 
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
 

Similar to Developing Microservices with Apache Camel

Riga Dev Day 2016 - Microservices with Apache Camel & fabric8 on Kubernetes
Riga Dev Day 2016 - Microservices with Apache Camel & fabric8 on KubernetesRiga Dev Day 2016 - Microservices with Apache Camel & fabric8 on Kubernetes
Riga Dev Day 2016 - Microservices with Apache Camel & fabric8 on Kubernetes
Claus Ibsen
 

Similar to Developing Microservices with Apache Camel (20)

Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache Camel
 
Microservices with apache_camel_barcelona
Microservices with apache_camel_barcelonaMicroservices with apache_camel_barcelona
Microservices with apache_camel_barcelona
 
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
 
ApacheCon NA - Apache Camel K: connect your Knative serverless applications w...
ApacheCon NA - Apache Camel K: connect your Knative serverless applications w...ApacheCon NA - Apache Camel K: connect your Knative serverless applications w...
ApacheCon NA - Apache Camel K: connect your Knative serverless applications w...
 
Docker for Java Developers
Docker for Java DevelopersDocker for Java Developers
Docker for Java Developers
 
murakumo Cloud Controller
murakumo Cloud Controllermurakumo Cloud Controller
murakumo Cloud Controller
 
Developing Microservices with Apache Camel, by Claus Ibsen
Developing Microservices with Apache Camel, by Claus IbsenDeveloping Microservices with Apache Camel, by Claus Ibsen
Developing Microservices with Apache Camel, by Claus Ibsen
 
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
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018
 
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
 
ApacheCon NA - Apache Camel K: a cloud-native integration platform
ApacheCon NA - Apache Camel K: a cloud-native integration platformApacheCon NA - Apache Camel K: a cloud-native integration platform
ApacheCon NA - Apache Camel K: a cloud-native integration platform
 
Riga Dev Day 2016 - Microservices with Apache Camel & fabric8 on Kubernetes
Riga Dev Day 2016 - Microservices with Apache Camel & fabric8 on KubernetesRiga Dev Day 2016 - Microservices with Apache Camel & fabric8 on Kubernetes
Riga Dev Day 2016 - Microservices with Apache Camel & fabric8 on Kubernetes
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 
apachecamelk-april2019-190409093034.pdf
apachecamelk-april2019-190409093034.pdfapachecamelk-april2019-190409093034.pdf
apachecamelk-april2019-190409093034.pdf
 
Cloud Native Camel Design Patterns
Cloud Native Camel Design PatternsCloud Native Camel Design Patterns
Cloud Native Camel Design Patterns
 
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
 
Easy Cloud Native Transformation using HashiCorp Nomad
Easy Cloud Native Transformation using HashiCorp NomadEasy Cloud Native Transformation using HashiCorp Nomad
Easy Cloud Native Transformation using HashiCorp Nomad
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutes
 
Low Code Integration with Apache Camel.pdf
Low Code Integration with Apache Camel.pdfLow Code Integration with Apache Camel.pdf
Low Code Integration with Apache Camel.pdf
 

More from Claus Ibsen

Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Claus Ibsen
 

More from Claus Ibsen (18)

Camel JBang - Quarkus Insights.pdf
Camel JBang - Quarkus Insights.pdfCamel JBang - Quarkus Insights.pdf
Camel JBang - Quarkus Insights.pdf
 
Integrating systems in the age of Quarkus and Camel
Integrating systems in the age of Quarkus and CamelIntegrating systems in the age of Quarkus and Camel
Integrating systems in the age of Quarkus and Camel
 
Camel Day Italy 2021 - What's new in Camel 3
Camel Day Italy 2021 - What's new in Camel 3Camel Day Italy 2021 - What's new in Camel 3
Camel Day Italy 2021 - What's new in Camel 3
 
DevNation Live 2020 - What's new with Apache Camel 3
DevNation Live 2020 - What's new with Apache Camel 3DevNation Live 2020 - What's new with Apache Camel 3
DevNation Live 2020 - What's new with Apache Camel 3
 
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
 
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integrationSouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel Quarkus
 
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
 
State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)
 
Apache Camel K - Fredericia
Apache Camel K - FredericiaApache Camel K - Fredericia
Apache Camel K - Fredericia
 
JEEConf 2018 - Camel microservices with Spring Boot and Kubernetes
JEEConf 2018 - Camel microservices with Spring Boot and KubernetesJEEConf 2018 - Camel microservices with Spring Boot and Kubernetes
JEEConf 2018 - Camel microservices with Spring Boot and Kubernetes
 
Camel riders in the cloud
Camel riders in the cloudCamel riders in the cloud
Camel riders in the cloud
 
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
 
ApacheCon EU 2016 - Apache Camel the integration library
ApacheCon EU 2016 - Apache Camel the integration libraryApacheCon EU 2016 - Apache Camel the integration library
ApacheCon EU 2016 - Apache Camel the integration library
 
Developing Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containersDeveloping Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containers
 
Developing Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containersDeveloping Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containers
 
Apache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxApache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the box
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
 

Recently uploaded

Abu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu DhabiAbu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Monica Sydney
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
ayvbos
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
ayvbos
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Monica Sydney
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
F
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
pxcywzqs
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
F
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 

Recently uploaded (20)

Abu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu DhabiAbu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 

Developing Microservices with Apache Camel

  • 1. Microservices with Apache Camel Claus Ibsen (@davsclaus) Principal Software Engineer, Red Hat
  • 3. Your Speaker ● Principal Software Engineer at Red Hat ● Apache Camel ● 7 years working with Camel ● Author of Camel in Action books ● Contact ● E-mail: cibsen@redhat.com ● Twitter: @davsclaus ● Blog: http://davsclaus.com
  • 5. Agenda ● What is Apache Camel? ● Camel Microservices ● Demo ● Standalone ● with Docker ● with OpenShift 3 / Kubernetes ● More Information
  • 6. What is Apache Camel? ● Quote from the website
  • 7. What is Apache Camel? ● Integration Framework
  • 8. What is Apache Camel? ● What is Enterprise Integration Patterns? It's a book
  • 9. What is Apache Camel? ● Enterprise Integration Patterns http://camel.apache.org/eip
  • 10. What is Apache Camel? ● EIP - Content Based Router
  • 11. What is Apache Camel? from newOrder
  • 12. What is Apache Camel? from newOrder choice
  • 13. What is Apache Camel? from newOrder choice when isWidget to widget
  • 14. What is Apache Camel? from newOrder choice when isWidget to widget otherwise to gadget
  • 15. What is Apache Camel? from(newOrder) choice when(isWidget) to(widget) otherwise to(gadget)
  • 16. What is Apache Camel? from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
  • 17. What is Apache Camel? Endpoint newOrder = endpoint("activemq:queue:newOrder"); from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
  • 18. 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);
  • 19. 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);
  • 20. 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(); }
  • 21. 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(); } }
  • 22. 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(); } }
  • 23. 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>
  • 24. 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
  • 25. 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
  • 26. What is Apache Camel? ● Java DSL is just Java
  • 27. What is Apache Camel? ● XML DSL is just XML ● … with XSD schema for validation/tooling
  • 28. What is Apache Camel? ● Camel's Architecture
  • 29. What is Apache Camel? 150+ Components
  • 30. What is Apache Camel? 150+ Components
  • 31.
  • 32. +
  • 33. + +
  • 34. + + +
  • 36. Agenda ● What is Apache Camel? ● Camel Microservices ● Demo ● Standalone ● with Docker ● with OpenShift 3 / Kubernetes ● More Information
  • 37. Running Camel as Microservices Standalone Web Application Camel Spring XML Apache Karaf Camel Spring Boot Wildfly (wildfly-camel) Camel CDI vert.x (vertx-camel) Camel Guice Rest DSL
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 49. Camel Microservices ● Apache Karaf Apache Karaf (boot)
  • 50. Camel Microservices ● Apache Karaf Karaf Features OSGi Bundles Apache Karaf (boot)
  • 51. Camel Microservices ● Apache Karaf Karaf Features OSGi Bundles Apache Karaf (boot) Karaf Maven Plugin
  • 52. Camel Microservices ● Apache Karaf Karaf Features OSGi Bundles Apache Karaf (boot) Karaf Maven Plugin Custom Karaf (with your app) tar / zip file
  • 53. Camel Microservices ● Rest DSL ● Use Rest verbs GET POST PUT ... ● Swagger API ● Pluggable Transport
  • 57. Rest DSL example - add Swagger API
  • 58. Agenda ● What is Apache Camel? ● Camel Microservices ● Demo ● Hello Service ● Create the Camel projects ● Docker ● OpenShift v3 ● More Information
  • 59. Demo - Hello Service Hello Service
  • 60. Demo - Hello Service Hello Service Hi I am New York. Hello Claus how are you today? name=Claus
  • 61. Demo - Hello Service Java Standalone Apache Tomcat HTTP Hello Service
  • 62. Demo - Hello Service Java Standalone Apache Tomcat HTTP from timer to http to log from servlet transform Hello Service
  • 63. Demo - Create the Camel Projects Java Standalone Apache Tomcat HTTP from timer to http to log from servlet transform Hello Service camel-archetype-cdi camel-archetype-web
  • 64. Demo - Create the Camel Projects ● Using Command Shell ● From Eclipse
  • 65. Demo - Create the Camel Projects ● camel-archetype-web Ready to use out of the box
  • 66. Demo - Create the Camel Projects ● camel-archetype-cdi Not ready We need to change he code
  • 67. Demo - Create the Camel Projects ● add netty4-http endpoint CMD + ALT 4
  • 68. Demo - Create the Camel Projects ● configure netty4-http endpoint
  • 69. Demo - Create the Camel Projects ● change route to call netty
  • 70. Demo - Create the Camel Projects ● change bean to return a name
  • 71. Demo - Overview ● camel-archetype-cdi camel-archetype-web Java Standalone Apache Tomcat HTTP 8080 from timer to http to log from http transform We are ready to run standalone
  • 72. Demo - Running Standalone mvn camel:run
  • 73. Agenda ● What is Apache Camel? ● Camel Microservices ● Demo ● Hello Service ● Create the Camel projects ● Docker ● OpenShift v3 ● More Information
  • 74. Camel and Docker Maven Project Docker Maven Plugin Docker Image build
  • 75. Add Docker from Command Line
  • 76. Add Docker from Eclipse / IDEA CMD + ALT 4
  • 77. Docker Maven Plugin in pom.xml
  • 78. Build Docker Containers ● mvn clean install docker:build
  • 79. Build Docker Containers ● After build images in local Docker repository camel-archetype-cdi camel-archetype-web
  • 80. Agenda ● What is Apache Camel? ● Camel Microservices ● Demo ● Hello Service ● Create the Camel projects ● Docker ● OpenShift v3 ● More Information
  • 81. Static ● camel-archetype-cdi camel-archetype-web Java Standalone Apache Tomcat from timer to http to log from servlet transform HTTP 8080 hostname:port is static / hardcoded
  • 82. Dynamic ● camel-archetype-cdi camel-archetype-web Java Standalone Apache Tomcat from timer to http to log from servlet transform Service Kubernetes Service
  • 83. What is a Kubernetes Service ● Network Connection to one or more Pods ● Own fixed IP address and port http://fabric8.io/guide/services.html http://kubernetes.io/v1.1/docs/user-guide/services.html
  • 84. What is a Kubernetes Service ● kube-proxy on client http://fabric8.io/guide/services.html http://kubernetes.io/v1.1/docs/user-guide/services.html Java Standalone Apache Tomcat from timer to http to log from servlet transform kube-proxy Kubernetes Master service changes Service enlist
  • 85. Define Kubernetes Service ● Use fabric8 command Apache Tomcat from servlet transform Service
  • 86. Define Kubernetes Service ● Defined in pom.xml in <properties> Apache Tomcat from servlet transform Service Container Port = Inside Docker Container (e.g. the port of Apache Tomcat) Service Port = Outside Consumers of Service to use Name of service
  • 87. Generated kubernetes.json Apache Tomcat from http choice setBody Service
  • 88. Use Kubernetes Services Java Standalone from timer to http to log ● Environment Variables ● Hostname ● Port Injected by Kubernetes when starting a pod
  • 89. Camel - Use Kubernetes Service ● Use {{service:name}} in Camel Java Standalone from timer to http to log
  • 90. Microservice Demo - Ready for launch! ● camel-archetype-cdi camel-archetype-web Java Standalone Apache Tomcat from timer to http to log from http transform Service Service defined Ready to deploy to Kubernetes
  • 91. Deploy - myweb ● mvn -Pf8-local-deploy Apache Tomcat from http transform Service
  • 92. Deploy - camel-archetype-cdi ● mvn -Pf8-local-deploy Java Standalone from timer to http to log
  • 93. fabric8 web console ● http://fabric8.vagrant.f8
  • 94. OpenShift 3 CLI ● oc get pods docker CLI is also possible docker images docker ps
  • 95. OpenShift 3 CLI ● oc get services
  • 96. OpenShift 3 CLI ● oc logs -f <pod-name>
  • 97. OpenShift 3 CLI ● oc get routes
  • 98. Scaling up / down ● change controller replicas
  • 99. Scaling up / down ● Service Load Balancing
  • 100. Agenda ● What is Apache Camel? ● Camel Microservices ● Demo ● Hello Service ● Create the Camel projects ● Docker ● OpenShift v3 ● More Information
  • 101. More information ● Apache Camel Microservices ● http://camel.apache.org/camel-boot ● Fabric8 ● http://fabric8.io ● chat room #fabric8 on freenode ● Medium Fabric8 (blogs and videos) ● https://medium.com/fabric8-io