Camel Microservices With Spring Boot and Kubernetes
Camel Microservices With Spring Boot and Kubernetes
JPoint Moscow
April 2018
About me
● Senior Principal Software Engineer at Red Hat
from("file:data/inbox")
.to("jms:queue:order"); Java DSL
<route>
<from ri="file:data/inbox"/>
XML DSL
<to uri="jms:queue:order"/>
</route>
Camel Routes with Splitter
Camel Routes with Splitter
from("file:inbox")
Camel Routes with Splitter
from("file:inbox")
.split(body().tokenize("\n"))
Camel Routes with Splitter
from("file:inbox")
.split(body().tokenize("\n"))
.marshal(customToXml)
Custom data
transformation
Camel Routes with Splitter
from("file:inbox")
.split(body().tokenize("\n"))
.marshal(customToXml)
.to("activemq:line"); Custom data
transformation
Camel Architecture
Camel runs everywhere
Application Linux
Servers Containers
Camel connects everything
● AWS
● File
○ S3
● FTP
○ SQS
● JMS
○ Kinesis
● AMQP
○ ...
● JDBC Public Cloud ● Google
● SQL
○ BigQuery
● TCP/UDP
○ PubSub
● Mail
● Azure
● HDFS
○ Blob
● JPA
Enterprise ○ Queue
● MongoDB
Systems ● Kafka
● ... ● Box
● Dropbox
● Facebook
● CoAP SaaS ● Linkedin
● MQTT ● Salesforce
● PubNub ● SAP
IoT ● ServiceNow
+
+
+
+
+
+
+
+ =
+
Who is using Camel?
What about Camel in
the Cloud?
Monolith
MyApp
Slides by @burrsutter
Microservices
Microservices
Microservices
Microservices
Microservices
Microservices
Network of Services
Microservices == Distributed Computing
Container Container
JVM JVM
Service A Service C
Container
JVM
Service B
Microservices'ilities
API
Tracing Discovery
Monitoring Invocation
MyService
Logging Elasticity
Authentication Resilience
Pipeline
Microservices'ilities
+ Kubernetes
API
Tracing Discovery
Monitoring Invocation
MyService
Logging Elasticity
Authentication Resilience
Pipeline
Microservices'ilities
+ PaaS
API
Tracing Discovery
Monitoring Invocation
MyService
Logging Elasticity
Authentication Resilience
Pipeline
Microservices'ilities
+ Istio
API
Tracing Discovery
Monitoring Invocation
MyService
Logging Elasticity
Authentication Resilience
Pipeline
Microservices'ilities
+ API management
API
Tracing Discovery
Monitoring Invocation
MyService
Logging Elasticity
Authentication Resilience
Pipeline
But where is Camel?
API
Tracing Discovery
Monitoring Invocation
MyService
Logging Elasticity
Authentication Resilience
Pipeline
But where is Camel?
API
Tracing Discovery
Authentication Resilience
Pipeline
Microservices == Distributed Integration
Container Container
JVM JVM
Service A Service C
Container
JVM
Service B
Microservices == Distributed Integration
Container Container
JVM JVM
Service A Service C
Container
JVM
External
Service B Systems
THE THREE PILLARS OF AGILE INTEGRATION
Key foundational capabilities needed by today’s enterprises
DISTRIBUTED
CONTAINERS APIs
INTEGRATION
43
Camel in the Cloud
Best Practice - Small in Size
● Camel is light-weight
○ (camel-core 4mb)
○ + what you need
● If state is needed:
○ Data-grid ○ Storage
■ camel-infinispan ■ camel-sql
■ camel-hazelcast ■ camel-jpa
■ camel-ignite ■ camel-kafka
■ ... ■ ...
○ Kubernetes
■ Stateful-set
Best Practice - Configuration Management
● Kubernetes ConfigMap
○ Inject via ENV
○ Inject via files
● Kubernetes Secrets
○ Inject via ENV
○ Inject via files
$ kubectl get cm -o yaml my-configmap
apiVersion: v1
data:
fallback: I still got no response
kind: ConfigMap
Best Practice - Fault Tolerant
● Camel Retry ● Camel Hystrix
○ onException ○ circuit breaker
○ errorHandler
Best Practice - Fault Tolerant
● Camel Retry
○ onException
○ errorHandler
Best Practice - Fault Tolerant
● Camel Retry
○ onException
○ errorHandler
Thundering Herd
Problem
Best Practice - Health Checks
● Health Checks
○ camel-spring-boot actuator
○ wildfly-swarm monitor
● Readiness Probe
○ Kubernetes
● Liveness Probe
○ Kubernetes
Best Practice - EIP Patterns
● Works anywhere
Plugins
● Consul EIP Cloud Patterns Service Call
● Etcd
● Kubernetes
● Ribbon
● Zookeeper
from("timer")
.serviceCall("hello-service");
EIP Cloud Patterns Hystrix EIP
from("timer:foo")
.hystrix()
.to("http:myservice")
.onFallback()
.to("bean:myfallback")
.end()
EIP Cloud Patterns Distributed
Tracing
Camel Rest
Usable Camel capabilities
Camel Zipkin API
Camel OpenTracing
Tracing Discovery
Camel
Invocation
Monitoring Components
MyService
Logging Elasticity
Authentication Resilience
Pipeline
Camel Retry
Camel Hystrix
Demo Time
Basic Demo
Tip of the iceberg
https://developers.redhat.com/video/youtube/YQLOcjvbo9s
Free book
http://developers.redhat.com/promotions/microservices-for-java-developers
Not so free book
https://www.manning.com/books/kubernetes-in-action
Not so free book
● Discount code (39%):
camel39
https://www.manning.com/books/camel-in-action-second-edition
More Information
● Slides and Demo source code:
https://github.com/davsclaus/camel-riders-in-the-cloud/tree/moscow
● Apache Camel website:
http://camel.apache.org
● Best "What is Apache Camel" article:
https://dzone.com/articles/open-source-integration-apache
● My blog:
http://www.davsclaus.com
● DevNation Webinars:
https://developers.redhat.com/devnationlive
Q&A