Apache Camel is a very popular integration library that works very well with microservice architecture.
This talk introduces you to Apache Camel and how you can easily get started with Camel on your computer.
Then we cover how to create new Camel projects from scratch as micro services which you can boot using Camel or Spring Boot, or other micro containers such as Jetty or fat JARs. We then take a look at what options you have for monitoring and managing your Camel microservices
using tooling such as Jolokia, and hawtio web console.
The second part of this talk is about running Camel in the cloud. We start by showing you how you can use the Maven Docker Plugin to create a docker image of your Camel application and run it using docker on a single host. Then kubernetes enters the stage and we take a look at how you can deploy your docker images on a kubernetes cloud platform, and how thenfabric8 tooling can make this much easier for the Java developers.
At the end of this talk you will have learned about and seen in practice how to take a Java Camel project from scratch, turn that into a docker image, and how you can deploy those docker images in a scalable cloud platform based on Google's kubernetes.
ICT role in 21st century education and it's challenges.pdf
Microservices with Apache Camel
1. PUBLIC PRESENTATION | CLAUS IBSEN1
Microservices with Apache Camel
Claus Ibsen (@davsclaus)
Principal Software Engineer, Red Hat
2. PUBLIC PRESENTATION | CLAUS IBSEN2
Agenda
● What is Apache Camel?
● A little Example
● Microservice Demo
● Standalone
● with Docker
● with OpenShift 3 / Kubernetes
● More Information
3. PUBLIC PRESENTATION | CLAUS IBSEN3
Your Speaker
● Principal Software Engineer at Red Hat
● Apache Camel
● 7 years working with Camel
● Author of Camel in Action book
● Contact
● EMail: cibsen@redhat.com
● Twitter: @davsclaus
● Blog: http://davsclaus.com
● Linkedin: http://www.linkedin.com/in/davsclaus
4. PUBLIC PRESENTATION | CLAUS IBSEN4
Agenda
● What is Apache Camel?
● A little Example
● Microservice Demo
● Standalone
● with Docker
● with OpenShift 3 / Kubernetes
● More Information
6. PUBLIC PRESENTATION | CLAUS IBSEN6
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"
7. PUBLIC PRESENTATION | CLAUS IBSEN7
What is Apache Camel?
● What is Enterprise Integration Patterns?
It's a book
8. PUBLIC PRESENTATION | CLAUS IBSEN8
What is Apache Camel?
● Enterprise Integration Patterns
http://camel.apache.org/eip
9. PUBLIC PRESENTATION | CLAUS IBSEN9
What is Apache Camel?
● EIP - Content Based Router
30. PUBLIC PRESENTATION | CLAUS IBSEN30
What is Apache Camel?
● Summary
● Integration 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
31. PUBLIC PRESENTATION | CLAUS IBSEN31
Agenda
● What is Apache Camel?
● A little Example
● Microservice Demo
● Standalone
● with Docker
● with OpenShift 3 / Kubernetes
● More Information
37. PUBLIC PRESENTATION | CLAUS IBSEN37
Agenda
● What is Apache Camel?
● A little Example
● Microservice Demo
● Standalone
● with Docker
● with OpenShift 3 / Kubernetes
● More Information
38. PUBLIC PRESENTATION | CLAUS IBSEN38
Microservice Demo - Overview
● camel-archetype-cdi camel-archetype-web
Java Standalone Apache Tomcat
HTTP 8080
from timer
to http
to log
from http
choice
setBody
39. PUBLIC PRESENTATION | CLAUS IBSEN39
Creating new Camel Projects
● Using Command Shell
● From Eclipse
40. PUBLIC PRESENTATION | CLAUS IBSEN40
Creating new Camel Projects
● ... or
JBoss
Forge
42. PUBLIC PRESENTATION | CLAUS IBSEN42
Creating new Camel Projects
● camel-archetype-cdi
To run from CLI
mvn clean install
exec:java
43. PUBLIC PRESENTATION | CLAUS IBSEN43
Creating new Camel Projects
● add http component
Adds the chosen component
to the pom.xml file.
CMD + ALT
4
44. PUBLIC PRESENTATION | CLAUS IBSEN44
Creating new Camel Projects
● add change route to call http://localhost:8080
45. PUBLIC PRESENTATION | CLAUS IBSEN45
Creating new Camel Projects
● add change bean to return a name
46. PUBLIC PRESENTATION | CLAUS IBSEN46
Creating new Camel Projects
● camel-archetype-web
To run from CLI
mvn clean install
jetty:run
47. PUBLIC PRESENTATION | CLAUS IBSEN47
Microservice Demo - Overview
● camel-archetype-cdi camel-archetype-web
Java Standalone Apache Tomcat
HTTP 8080
from timer
to http
to log
from http
choice
setBody
We are ready to run standalone
48. PUBLIC PRESENTATION | CLAUS IBSEN48
Running Standalone
● camel-archetype-web
● Start Apache Tomcat with bin/cataline run
● Copy the .war to Tomcat deploy folder
50. PUBLIC PRESENTATION | CLAUS IBSEN50
Monitor using hawtio embedded in Tomcat
● Copy hawtio.war to Tomcat deploy folder
51. PUBLIC PRESENTATION | CLAUS IBSEN51
Agenda
● What is Apache Camel?
● A little Example
● Microservice Demo
● Standalone
● with Docker
● with OpenShift 3 / Kubernetes
● More Information
52. PUBLIC PRESENTATION | CLAUS IBSEN52
Camel and Docker
● Dockerizing your Camel Projects
● Using Roland Huss's Docker Maven Plugin
● https://github.com/rhuss/docker-maven-plugin
.. by manually adding to pom.xml and configure
● ... but we use the Forge
53. PUBLIC PRESENTATION | CLAUS IBSEN53
Camel and Docker
● Dockerizing your Camel Projects with JBoss Forge
● From CLI Add FORGE_HOME/bin to
$PATH
54. PUBLIC PRESENTATION | CLAUS IBSEN54
Camel and Docker
● Dockerizing your Camel Projects with JBoss Forge
● From Eclipse
IDEA
NetBeans
● ... and web
CMD + ALT
4
Sorry I only have an old screenshot of forge-web
55. PUBLIC PRESENTATION | CLAUS IBSEN55
Camel and Docker
● Build Docker Containers
● mvn clean install docker:build
● ... Images now in your local docker repository
camel-archetype-cdi
camel-archetype-web
docker-maven-plugin
uses
$DOCKER_HOST
Fabric8 w/ OpenShift 3:
DOCKER_HOST="tcp://vagrant.local:2375"
Boot2Docker:
DOCKER_HOST="tcp://192.168.59.105:2375"
56. PUBLIC PRESENTATION | CLAUS IBSEN56
Camel and Docker
● Run Docker Containers
● docker run -it -p 8080:8080 -p 8778:8778
172.30.111.183:5000/fabric8/myweb:1.0-SNAPSHOT
The 10.000$$$ Docker Question
What the f$QRC#%A%%EG
is the IP address of the container
8080 = Tomcat
8778 = Jolokia
57. PUBLIC PRESENTATION | CLAUS IBSEN57
Camel and Docker
● What is the IP Address of the Docker Container
58. PUBLIC PRESENTATION | CLAUS IBSEN58
Camel and Docker
● camel-archetype-cdi
● I would need to change the hostname to
the docker assigned IP address
59. PUBLIC PRESENTATION | CLAUS IBSEN59
Camel and Docker
● camel-archetype-cdi
● .. and then build the docker image
● And then run the docker image
● docker run -it 172.30.111.183:5000/fabric8/mycdi:1.0-
SNAPSHOT
60. PUBLIC PRESENTATION | CLAUS IBSEN60
Camel and Docker
● Pheeew isn't this easier?
Yes !!!
61. PUBLIC PRESENTATION | CLAUS IBSEN61
Agenda
● What is Apache Camel?
● A little Example
● Microservice Demo
● Standalone
● with Docker
● with OpenShift 3 / Kubernetes
● More Information
62. PUBLIC PRESENTATION | CLAUS IBSEN62
Microservices Demo - Recap
● camel-archetype-cdi camel-archetype-web
Java Standalone Apache Tomcat
HTTP 8080
from timer
to http
to log
from http
choice
setBody
63. PUBLIC PRESENTATION | CLAUS IBSEN63
Microservices Demo - Use Service
● camel-archetype-cdi camel-archetype-web
Java Standalone Apache Tomcat
from timer
to http
to log
from http
choice
setBody
Service
Kubernetes
Service
64. PUBLIC PRESENTATION | CLAUS IBSEN64
What is a Kubernetes Service
● Kubernetes Service
http://fabric8.io/guide/services.html
65. PUBLIC PRESENTATION | CLAUS IBSEN65
Define Kubernetes Service
● Define in pom.xml in <properties>
Apache Tomcat
from http
choice
setBody
Service
Container Port = Inside Docker Container
(e.g. the port of Apache Tomcat)
Service Port = Outside
Consumers of Service to use
Name of service
66. PUBLIC PRESENTATION | CLAUS IBSEN66
Define Kubernetes Service
● ... generates into kubernetes.json
using fabric8:json plugin
Apache Tomcat
from http
choice
setBody
Service
67. PUBLIC PRESENTATION | CLAUS IBSEN67
About using Kubernetes Service
Discover Kubernetes Services
Java Standalone
from timer
to http
to log
68. PUBLIC PRESENTATION | CLAUS IBSEN68
Client - Use Kubernetes Service
● Use {{service:name}} in Camel
... you can use default values
{{service:name:host:port}}
Java Standalone
from timer
to http
to log
host:port would be default
if service is not discovered
69. PUBLIC PRESENTATION | CLAUS IBSEN69
Microservice Demo - Ready for launch!
● camel-archetype-cdi camel-archetype-web
Java Standalone Apache Tomcat
from timer
to http
to log
from http
choice
setBody
Service
Service defined
Ready to deploy to Kubernetes
70. PUBLIC PRESENTATION | CLAUS IBSEN70
Deploy - camel-archetype-web
● camel-archetype-web
● mvn clean install docker:build
fabric8:apply Apache Tomcat
from http
choice
setBody
Service
71. PUBLIC PRESENTATION | CLAUS IBSEN71
Deploy - camel-archetype-cdi
● camel-archetype-cdi
● mvn clean install docker:build
fabric8:apply Java Standalone
from timer
to http
to log
72. PUBLIC PRESENTATION | CLAUS IBSEN72
fabric8 web console
● http://fabric8.vagrant.local
● Easy by configuring the replication size
73. PUBLIC PRESENTATION | CLAUS IBSEN73
OpenShift 3 CLI
● osc get pods
docker CLI is also possible
docker images
docker ps
76. PUBLIC PRESENTATION | CLAUS IBSEN76
Scaling up / down
● ... by changing replication size on controller
77. PUBLIC PRESENTATION | CLAUS IBSEN77
Scaling up / down
● web console shows we now have 3 pods
78. PUBLIC PRESENTATION | CLAUS IBSEN78
Scaling up / down
● and the camel-archetype-cli pod is load balancing the
mycoolservice among the 3 live pods
79. PUBLIC PRESENTATION | CLAUS IBSEN79
Agenda
● What is Apache Camel?
● A little Example
● Microservice Demo
● Standalone
● with Docker
● with OpenShift 3 / Kubernetes
● More Information
80. PUBLIC PRESENTATION | CLAUS IBSEN80
Where do I get more information?
● Apache Camel Microservices
● http://camel.apache.org/camel-boot
● Fabric8
● http://fabric8.io
● chat room #fabric-8 on freenode
● OpenShift 3
● https://github.com/openshift/origin
● Kubernetes
● https://github.com/googlecloudplatform/kubernetes