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.
Real-world #microservices
with Apache Camel and
Fabric8
Who?
Christian Posta
Principal Middleware Specialist/Architect
Blog: http://christianposta.com/blog
Twitter: @christianpos...
• Microservices
• Heavy lifting with Apache Camel
• Managing microservices with Fuse,
Fabric8 v1
• OpenShift, Fabric8 v2
•...
Why do we care?
Micro what?
• Services, reuse, composition
• Loose coupling!
• Contracts
• Incremental change
• “Business Agility”
SOA!
SOA made smaller… micro even…
So what are microservices?
A term that helps describe distributed systems
that organically evolve into scalable, loosely
coupled, modular sets of ser...
• If my services are isolated at the
process level, I’m doing
#microservices
• If I use REST/Thrift/ProtoBuf
instead of SO...
• Agile methodology
• SOA principles
• Domain Driven Design
• Hexagonal Architectures
• Pipes and Filters
• Actor Model
• ...
• Modularity!
• Flexible technology options
• “Smart endpoints” “dumb pipes”
• Evolving design
• Independently scalable
• ...
Isolation: logical or physical?
• No silver bullet; distributed systems are
*hard*
• Dependency hell, custom shared libraries
• Fragmented and inconsisten...
Apache Camel for
microservices?
Real developers ride Camels!
2
Apache Camel
Apache Camel is an open-source,
light-weight, integration library.
Use Camel to integrate disparate systems...
Apache Camel
Enterprise Integration Patterns
http://camel.apache.org/eip
Features
● Enterprise Integration Patterns (EIPs)
● Domain Specific Language to write “flows” or “routes”
● Large collecti...
Java DSL
public class OrderProcessorRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception...
Spring XML DSL
<route id=“processOrders”>
<from uri=“activemq:orders”/>
<choice>
<when>
<simple>${header.customer-rating} ...
Camel - JBoss Developer Studio
• Dynamic routing options
• REST DSL
• Backpressure mechanisms
• Loadbalancing algorithms / Circuit Breaker
pattern
Heavy ...
• “Smart endpoints, dumb pipes”
• Endpoint does one thing well
• Metadata used for further routing
• Really “dynamic” with...
• Content Based Router
• Dynamic Router
• Routing Slip
• Recipient List
Dynamic Routing
• Expressive way to define REST endpoints
• POST, REST, PUT
• Auto binding to POJOs
• Plugs into Swagger for interface
def...
REST DSL
public class OrderProcessorRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception...
• Backpressure is a way for a service to flow
control callers
• Detecting when can be difficult
• Need to bound processing...
• Throttle EIP
• http://camel.apache.org/throttler.html
• Blocking SEDA Queue
• from(“seda:name?size=100&blockWhenFull=tru...
• Useful to keep from overloading a system
(use in conjunction with backpressure if you
can)
• Smart loadbalancing
• Stick...
Circuit breaker
Image from http://martinfowler.com/bliki/CircuitBreaker.html
Circuit breaker
public class OrderProcessorRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Ex...
More Information
● Camel in Action
● Apache Camel Developer’s Cookbook
● Community website
○ http://camel.apache.org/
JBoss Fuse (Red Hat
product)
RED HAT JBOSS FUSE
Development and tooling
Develop, test, debug, refine,
deploy
JBoss Developer Studio
Web services framew...
Managing microservice
deployments
• Simplifies deployments
• Provides centralized configuration
• Versioning
• Visualization of your middleware
• Service di...
• Implemented with Zookeeper and git
• Intended to be used with a dynamic
JVM/Apache Karaf
• Profiles store configuration,...
• Registry
• Where configs are stored, everything centrally
managed
• Profiles
• Description of end-state deployment of a ...
Quick Demo V1
• Implemented with Docker and Kubernetes
• Use any JVM (or any technology)
• Docker images, encourage static, well-
define...
Docker / Linux Containers
How different than VMs?
Kubernetes
• Pods
• Services
• Replication Controllers
Kubernetes
Red Hat’s PaaS: OpenShift
Public
PaaS
Service
On-premise
or Private
PaaS
Software
Open
Source
PaaS
Project
Scale IT Like a Factory with PaaS
Quick Demo V2
Demo and Questions
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Upcoming SlideShare
Loading in …5
×

Real-world #microservices with Apache Camel, Fabric8, and OpenShift

1,392 views

Published on

What are and aren't microservices?
Microservices is a validation of the open-source approach to integration and service implementation and a rebuff of the committee-driven SOA approach. In this

Published in: Software
  • Be the first to comment

Real-world #microservices with Apache Camel, Fabric8, and OpenShift

  1. 1. Real-world #microservices with Apache Camel and Fabric8
  2. 2. Who? Christian Posta Principal Middleware Specialist/Architect Blog: http://christianposta.com/blog Twitter: @christianposta Email: christian@redhat.com • Committer on Apache Camel, ActiveMQ, Fabric8, PMC on ActiveMQ • Author: Essential Camel Components DZone Refcard • Frequent blogger and speaker about open-source technology!
  3. 3. • Microservices • Heavy lifting with Apache Camel • Managing microservices with Fuse, Fabric8 v1 • OpenShift, Fabric8 v2 • Beer (lots?) Agenda
  4. 4. Why do we care?
  5. 5. Micro what?
  6. 6. • Services, reuse, composition • Loose coupling! • Contracts • Incremental change • “Business Agility” SOA!
  7. 7. SOA made smaller… micro even… So what are microservices?
  8. 8. A term that helps describe distributed systems that organically evolve into scalable, loosely coupled, modular sets of services that work together to deliver business value with acceptable tradeoffs. So what are microservices?
  9. 9. • If my services are isolated at the process level, I’m doing #microservices • If I use REST/Thrift/ProtoBuf instead of SOAP, I’m doing #microservices • If I use JSON, I’m doing #microservices • If I use no-container / SpringBoot / Dropwizard / embedded Jetty, I’m doing #microservices I’m doing microservices if…
  10. 10. • Agile methodology • SOA principles • Domain Driven Design • Hexagonal Architectures • Pipes and Filters • Actor Model • REST • SEDA Microservices emerged as a result…
  11. 11. • Modularity! • Flexible technology options • “Smart endpoints” “dumb pipes” • Evolving design • Independently scalable • Automation, DevOps philosophy • Decentralized, choreographed interactions • Testable • Design for failure Microservices…
  12. 12. Isolation: logical or physical?
  13. 13. • No silver bullet; distributed systems are *hard* • Dependency hell, custom shared libraries • Fragmented and inconsistent management • Team communication challenges • Health checking, monitoring, liveness • Over architecting, performance concerns, things spiraling out of control fast Challenges ahead…
  14. 14. Apache Camel for microservices?
  15. 15. Real developers ride Camels!
  16. 16. 2 Apache Camel Apache Camel is an open-source, light-weight, integration library. Use Camel to integrate disparate systems that speak different protocols and data formats
  17. 17. Apache Camel Enterprise Integration Patterns http://camel.apache.org/eip
  18. 18. Features ● Enterprise Integration Patterns (EIPs) ● Domain Specific Language to write “flows” or “routes” ● Large collection of adapters/components for legacy systems, B2B, and SaaS ● Strong Unit test/Integration test framework ● Expression languages ● Data Formats ● Tooling with JBoss Developer Studio
  19. 19. Java DSL public class OrderProcessorRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { from(“activemq:orders”) .choice() .when(header(“customer-rating”).isEqualTo(“gold”)) .to(“ibmmq:topic:specialCustomer”) .otherwise() .to(“ftp://user@host/orders/regularCustomers”) .end() .log(“received new order ${body.orderId}”) .to(“ibatis:storeOrder?statementType=Insert”); } }
  20. 20. Spring XML DSL <route id=“processOrders”> <from uri=“activemq:orders”/> <choice> <when> <simple>${header.customer-rating} == ‘gold’</simple> <to uri=“wmq:topic:specialCustomer”> </when> <otherwise> <to uri=“ftp://user@host/orders/regularCustomers” /> </otherwise> </choice> <log message=“received new order ${body.orderId}”/> <to uri=“ibatis:storeOrder?statementType=Insert”/> </route>
  21. 21. Camel - JBoss Developer Studio
  22. 22. • Dynamic routing options • REST DSL • Backpressure mechanisms • Loadbalancing algorithms / Circuit Breaker pattern Heavy Lifting: Camel for Microservices
  23. 23. • “Smart endpoints, dumb pipes” • Endpoint does one thing well • Metadata used for further routing • Really “dynamic” with rules engine (eg, Drools/BRMS) Dynamic Routing
  24. 24. • Content Based Router • Dynamic Router • Routing Slip • Recipient List Dynamic Routing
  25. 25. • Expressive way to define REST endpoints • POST, REST, PUT • Auto binding to POJOs • Plugs into Swagger for interface definition/documentation • Uses configurable HTTP engine • camel-netty-http • camel-jetty • camel-reslet • camel-sevlet (deploy into other containers) • camel-spark-rest REST DSL (2.14)
  26. 26. REST DSL public class OrderProcessorRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { rest().post(“/order/socks”) .description(“New Order for pair of socks”) .consumes(“application/json”) .route() .to(“activemq:topic:newOrder”) .log(“received new order ${body.orderId}”) .to(“ibatis:storeOrder?statementType=Insert”); } }
  27. 27. • Backpressure is a way for a service to flow control callers • Detecting when can be difficult • Need to bound processing queues in a SEDA • Take advantage of built in TCP flow control for socket/http requests Backpressure with Camel
  28. 28. • Throttle EIP • http://camel.apache.org/throttler.html • Blocking SEDA Queue • from(“seda:name?size=100&blockWhenFull=true) • Configure jetty/netty to use blocking acceptor queues • https://wiki.eclipse.org/Jetty/Howto/High_Load • Using Exception handling/retry and DLQ logic when getting flow controlled • http://camel.apache.org/error-handling-in-camel.html Backpressure with Camel
  29. 29. • Useful to keep from overloading a system (use in conjunction with backpressure if you can) • Smart loadbalancing • Sticky • Random • Failover • Circuit breaker Loadbalance/Circuit breaker
  30. 30. Circuit breaker Image from http://martinfowler.com/bliki/CircuitBreaker.html
  31. 31. Circuit breaker public class OrderProcessorRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { from(“direct:someinterface”) .loadbalance() .circuitBreaker(3, 20000L, MyException.class) .to(“ibatis:storeOrder?statementType=Insert”); } }
  32. 32. More Information ● Camel in Action ● Apache Camel Developer’s Cookbook ● Community website ○ http://camel.apache.org/
  33. 33. JBoss Fuse (Red Hat product)
  34. 34. RED HAT JBOSS FUSE Development and tooling Develop, test, debug, refine, deploy JBoss Developer Studio Web services framework Web services standards, SOAP, XML/HTTP, RESTful HTTP Integration framework Transformation, mediation, enterprise integration patterns Management and monitoring System and web services metrics, automated discovery, container status, automatic updates JBoss Operations Network + JBoss Fabric Management Console (hawtio) Apache CXF Apache Camel Reliable Messaging JMS/STOMP/NMS/MQTT, publishing-subscribe/point-2-point, store and forward Apache ActiveMQ Container Life cycle management, resource management, dynamic deployment, security and provisioning Apache Karaf + Fuse Fabric RED HAT ENTERPRISE LINUX Windows, UNIX, and other Linux
  35. 35. Managing microservice deployments
  36. 36. • Simplifies deployments • Provides centralized configuration • Versioning • Visualization of your middleware • Service discovery • Smart load balancing • Failover • Provides cluster capabilities, coordination http://fabric8.io
  37. 37. • Implemented with Zookeeper and git • Intended to be used with a dynamic JVM/Apache Karaf • Profiles store configuration, metadata, end- state deployments • Networking, JVM isolation, orchestration, auto-scaling, health checks, cloud deployments: all up to you Fabric8 V1.x
  38. 38. • Registry • Where configs are stored, everything centrally managed • Profiles • Description of end-state deployment of a server • Agent • Listens on the server that can respond to registry changes/profile updates Fabric8 V1.x
  39. 39. Quick Demo V1
  40. 40. • Implemented with Docker and Kubernetes • Use any JVM (or any technology) • Docker images, encourage static, well- defined, well-tested deployments • Provides networking, JVM isolation, orchestration, auto-scaling, health checks, cloud deployments • Still in community! Proving this out! Fabric8 V2
  41. 41. Docker / Linux Containers
  42. 42. How different than VMs?
  43. 43. Kubernetes
  44. 44. • Pods • Services • Replication Controllers Kubernetes
  45. 45. Red Hat’s PaaS: OpenShift Public PaaS Service On-premise or Private PaaS Software Open Source PaaS Project
  46. 46. Scale IT Like a Factory with PaaS
  47. 47. Quick Demo V2
  48. 48. Demo and Questions

×