Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

JEEConf 2018 - Camel microservices with Spring Boot and Kubernetes

580 views

Published on

Apache Camel has fundamentally changed the way enterprise Java developers think about system-to-system integration by making enterprise integration patterns (EIP) a simple declaration in a lightweight application wrapped and delivered as a single JAR.

In this session, we’ll show you how to bring the best practices from the EIP world together with containers, running on top of Kubernetes, and deployed as Spring Boot microservices, which are both cloud-native and cloud-portable.

Building and designing cloud-native microservices impacts how we develop. We’ll discuss practices how to build distributed and fault-tolerant microservices with technologies such as Kubernetes Services, Netflix Hystrix, Camel EIP patterns, and Istio. You will see live demos of us killing containers to test fault tolerance, and more.

Published in: Software

JEEConf 2018 - Camel microservices with Spring Boot and Kubernetes

  1. 1. Camel microservices with Spring Boot and Kubernetes JEEConf May 2018 Claus Ibsen @davsclaus
  2. 2. I was last here at JEEConf in 2011
  3. 3. 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
  4. 4. System Integration
  5. 5. Integration Framework
  6. 6. PATTERN BASED INTEGRATION 200+ COMPONENTS Batch, messaging, web services, cloud, APIs, and more ... BUILT-IN DATA TRANSFORMATION JSON, XML, HL7, YAML, SOAP, Java, CSV, and more ... INTUITIVE ROUTING Develop integrations quickly in Java or XML. ENTERPRISE INTEGRATION PATTERNS Build integrations using enterprise best practices. Create, connect, and compose APIs with ease. NATIVE REST SUPPORT Apache Camel, a powerful pattern-based integration engine with a comprehensive set of connectors and data formats to tackle any integration problem.
  7. 7. Enterprise Integration Patterns
  8. 8. Enterprise Integration Patterns
  9. 9. Camel Routes from("file:data/inbox") .to("jms:queue:order"); <route> <from uri="file:data/inbox"/> <to uri="jms:queue:order"/> </route> Java DSL XML DSL
  10. 10. Camel Routes with Splitter
  11. 11. Camel Routes with Splitter from("file:inbox")
  12. 12. Camel Routes with Splitter from("file:inbox") .split(body().tokenize("n"))
  13. 13. Camel Routes with Splitter from("file:inbox") .split(body().tokenize("n")) .marshal(customToXml) Custom data transformation
  14. 14. Camel Routes with Splitter from("file:inbox") .split(body().tokenize("n")) .marshal(customToXml) .to("activemq:line"); Custom data transformation
  15. 15. Camel Architecture
  16. 16. Camel runs everywhere Application Servers Linux Containers
  17. 17. Camel connects everything Enterprise Systems ● File ● FTP ● JMS ● AMQP ● JDBC ● SQL ● TCP/UDP ● Mail ● HDFS ● JPA ● MongoDB ● Kafka ● ... Public Cloud ● AWS ○ S3 ○ SQS ○ Kinesis ○ ... ● Google ○ BigQuery ○ PubSub ● Azure ○ Blob ○ Queue ● Box ● Dropbox ● Facebook ● Linkedin ● Salesforce ● SAP ● ServiceNowIoT ● CoAP ● MQTT ● PubNub SaaS
  18. 18. +
  19. 19. + +
  20. 20. + + +
  21. 21. + + + =
  22. 22. What about Camel in the Cloud?
  23. 23. Monolith MyApp Slides by @burrsutter
  24. 24. Microservices
  25. 25. Microservices
  26. 26. Microservices
  27. 27. Microservices
  28. 28. Microservices
  29. 29. Microservices
  30. 30. Network of Services
  31. 31. Container JVM Service C Microservices == Distributed Computing Container JVM Service B Container JVM Service A
  32. 32. MyService Monitoring Tracing API Discovery Invocation Resilience Pipeline Authentication Logging Elasticity Microservices'ilities
  33. 33. MyService Monitoring Tracing API Discovery Invocation Resilience Pipeline Authentication Logging Elasticity Microservices'ilities + Kubernetes
  34. 34. MyService Monitoring Tracing API Discovery Invocation Resilience Pipeline Authentication Logging Elasticity Microservices'ilities + PaaS
  35. 35. MyService Monitoring Tracing API Discovery Invocation Resilience Pipeline Authentication Logging Elasticity Microservices'ilities + Istio
  36. 36. MyService Monitoring Tracing API Discovery Invocation Resilience Pipeline Authentication Logging Elasticity Microservices'ilities + API management
  37. 37. MyService Monitoring Tracing API Discovery Invocation Resilience Pipeline Authentication Logging Elasticity But where is Camel?
  38. 38. MyService Monitoring Tracing API Discovery Invocation Resilience Pipeline Authentication Logging Elasticity But where is Camel? embedded in your (Java) services
  39. 39. Container JVM Service C Microservices == Distributed Integration Container JVM Service B Container JVM Service A
  40. 40. Container JVM Service C Microservices == Distributed Integration Container JVM Service B Container JVM Service A External Systems
  41. 41. 43 THE THREE PILLARS OF AGILE INTEGRATION Key foundational capabilities needed by today’s enterprises DISTRIBUTED INTEGRATION -LIGHTWEIGHT -PATTERN BASED -EVENT ORIENTED -COMMUNITY SOURCED CONTAINERS - CLOUD NATIVE SOLUTIONS -LEARN ARTIFACTS, INDIVIDUALLY DEPLOYABLE - CONTAINER BASED SCALING AND HIGH AVAILABILITY APIs -WELL DEFINED, REUSABLE, AND WELL MANAGED END-POINTS -ECOSYSTEM LEVERAGE FLEXIBILITY SCALABILITY RE-USABILITY
  42. 42. Camel in the Cloud
  43. 43. Best Practice - Small in Size ● Camel is light-weight ○ (camel-core 4mb) ○ + what you need ● Single fat-jar via:
  44. 44. Best Practice - Stateless ● Favour stateless applications ● If state is needed: ○ Data-grid ■ camel-infinispan ■ camel-hazelcast ■ camel-ignite ■ ... ○ Storage ■ camel-sql ■ camel-jpa ■ camel-kafka ■ ... ○ Kubernetes ■ Stateful-set
  45. 45. ● Kubernetes ConfigMap ○ Inject via ENV ○ Inject via files ● Kubernetes Secrets ○ Inject via ENV ○ Inject via files Best Practice - Configuration Management $ kubectl get cm -o yaml my-configmap apiVersion: v1 data: fallback: I still got no response kind: ConfigMap
  46. 46. Best Practice - Fault Tolerant ● Camel Retry ○ onException ○ errorHandler ● Camel Hystrix ○ circuit breaker
  47. 47. Best Practice - Fault Tolerant ● Camel Retry ○ onException ○ errorHandler
  48. 48. Best Practice - Fault Tolerant ● Camel Retry ○ onException ○ errorHandler Thundering Herd Problem
  49. 49. Best Practice - Health Checks ● Health Checks ○ camel-spring-boot actuator ○ wildfly-swarm monitor ● Readiness Probe ○ Kubernetes ● Liveness Probe ○ Kubernetes
  50. 50. ● Works anywhere Best Practice - EIP Patterns
  51. 51. EIP Cloud Patterns Service Call from("timer") .serviceCall("hello-service"); Plugins ● Consul ● Etcd ● Kubernetes ● Ribbon ● Zookeeper
  52. 52. EIP Cloud Patterns Hystrix EIP from("timer:foo") .hystrix() .to("http:myservice") .onFallback() .to("bean:myfallback") .end()
  53. 53. EIP Cloud Patterns rest().post("train/buy/seat") .saga() .compensation("direct:cancel") ... .to("http:trainservice/buy") Saga EIP
  54. 54. EIP Cloud Patterns Distributed Tracing
  55. 55. MyService Monitoring Tracing API Discovery Invocation Resilience Pipeline Authentication Logging Elasticity Usable Camel capabilities Camel Retry Camel Hystrix Camel Zipkin Camel OpenTracing Camel Rest Camel Components
  56. 56. Demo Time
  57. 57. Basic Demo
  58. 58. Tip of the iceberg Figure by Bilgin Ibryam
  59. 59. Free book http://developers.redhat.com/promotions/microservices-for-java-developers
  60. 60. Not so free book https://www.manning.com/books/kubernetes-in-action
  61. 61. Not so free book ● Discount code (39%): camel39 (ordering from Manning) https://www.manning.com/books/camel-in-action-second-edition
  62. 62. More Information ● Slides and Demo source code: https://github.com/davsclaus/camel-riders-in-the-cloud ● 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
  63. 63. Q & A

×