Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
260 views

Camel Microservices With Spring Boot and Kubernetes

This document discusses using Apache Camel for microservices integration with Spring Boot and Kubernetes. It provides an overview of Camel's capabilities for integration patterns, components, data transformation and routing. It also covers architectural best practices for running Camel in containers and cloud environments like Kubernetes, including making services stateless, managing configuration, and building in fault tolerance.

Uploaded by

d852820
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
260 views

Camel Microservices With Spring Boot and Kubernetes

This document discusses using Apache Camel for microservices integration with Spring Boot and Kubernetes. It provides an overview of Camel's capabilities for integration patterns, components, data transformation and routing. It also covers architectural best practices for running Camel in containers and cloud environments like Kubernetes, including making services stateless, managing configuration, and building in fault tolerance.

Uploaded by

d852820
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Camel microservices with

Spring Boot and


Kubernetes
Claus Ibsen
@davsclaus

JPoint Moscow
April 2018
About me
● Senior Principal Software Engineer at Red Hat

● 10 years as Apache Camel committer

● Author of Camel in Action books

● Based in Denmark Blog: http://www.davsclaus.com


Twitter: @davsclaus
Linkedin: davsclaus
System Integration
Integration Framework
PATTERN BASED INTEGRATION
Apache Camel, a powerful pattern-based integration engine with a comprehensive
set of connectors and data formats to tackle any integration problem.

ENTERPRISE 200+ BUILT-IN DATA INTUITIVE NATIVE REST


INTEGRATION COMPONENTS TRANSFORMATION ROUTING SUPPORT
PATTERNS
Build integrations Batch, messaging, JSON, XML, HL7, Develop Create, connect,
using enterprise best web services, cloud, YAML, SOAP, Java, integrations quickly and compose APIs
practices. APIs, and more ... CSV, and more ... in Java or XML. with ease.
Enterprise Integration Patterns
Enterprise Integration Patterns
Camel Routes

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

Monitoring Invocation embedded in


MyService your (Java)
services
Logging Elasticity

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

-LIGHTWEIGHT - CLOUD NATIVE SOLUTIONS -WELL DEFINED, REUSABLE,


-PATTERN BASED -LEARN ARTIFACTS, AND WELL MANAGED
-EVENT ORIENTED INDIVIDUALLY DEPLOYABLE END-POINTS
- CONTAINER BASED SCALING -ECOSYSTEM LEVERAGE
-COMMUNITY SOURCED
AND HIGH AVAILABILITY

FLEXIBILITY SCALABILITY RE-USABILITY

43
Camel in the Cloud
Best Practice - Small in Size
● Camel is light-weight
○ (camel-core 4mb)
○ + what you need

● Single fat-jar via:


Best Practice - Stateless
● Favour stateless applications

● 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

Figure by Bilgin Ibryam


Service Mesh
Service Mesh
Service Mesh Webinar

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

(ordering from Manning)

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

You might also like