microservices with apache camel, docker and fabric8 v2

40
#microservices with Apache Camel, Docker and Fabric8v2

Upload: ceposta

Post on 06-Aug-2015

1.079 views

Category:

Software


8 download

TRANSCRIPT

Page 1: Microservices with Apache Camel, Docker and Fabric8 v2

#microservices with Apache Camel, Docker and Fabric8v2

Page 2: Microservices with Apache Camel, Docker and Fabric8 v2

Christian PostaPrincipal Middleware Specialist/Architect

Blog: http://blog.christianposta.com

Twitter: @christianposta

Email: [email protected]

• Committer on Apache Camel, Apache ActiveMQ, Fabric8

• Recovering consultant

• Spent lot of time working with one of the largest Microservices, web-

scale, unicorn companies

• Frequent blogger and speaker about open-source, cloud, and

microservices

Page 3: Microservices with Apache Camel, Docker and Fabric8 v2

• Microservices: the good, the bad

• Do you even need integration?

• Real developers ride Camels

• Microservices the Docker way with

Fabric8

• Questions / Demo

Agenda

Page 4: Microservices with Apache Camel, Docker and Fabric8 v2

Microservices: the good, the bad

Page 5: Microservices with Apache Camel, Docker and Fabric8 v2
Page 6: Microservices with Apache Camel, Docker and Fabric8 v2

• Agile• SOA principles• Domain Driven Design• Hexagonal Architectures• Pipes and Filters• Actor Model• SEDA

Microservices not really new, per-se

Page 7: Microservices with Apache Camel, Docker and Fabric8 v2
Page 8: Microservices with Apache Camel, Docker and Fabric8 v2

A way to organize teams that mimic the

structure of an organization for greater

autonomy and reduced cross-team

synchronization for the purposes of scalability,

faster solution delivery, and ability to manage

complexity at the expense of known tradeoffs.

So what is “Microservices”?

Page 9: Microservices with Apache Camel, Docker and Fabric8 v2

• Faster software delivery

• Potential for faster innovation

• Scale easier

• Right technology stack for the problem

• Grok services easier

• Test individual services easier

• Individual deployments

Page 10: Microservices with Apache Camel, Docker and Fabric8 v2

• System complexity

• Operational complexity

• Testing is harder across services

• Security

• It’s freakin hard

• Resource overhead

• Network overhead

• Lack of tooling

Drawbacks

Page 11: Microservices with Apache Camel, Docker and Fabric8 v2

1. Do you have a scaling problem?

2. You need to deliver software much faster?

3. Do you have organizational complexity?

When do you do microservices:

Page 12: Microservices with Apache Camel, Docker and Fabric8 v2

• Understanding of modularity, API design

• Small, cross-functional teams (pizza box)

• Self service access to infrastructure

• Strong automation capabilities

• Mature CI/CD practices

Foundations of Microservices

Page 13: Microservices with Apache Camel, Docker and Fabric8 v2

Do YOU want to do Microservices?

Page 15: Microservices with Apache Camel, Docker and Fabric8 v2

Do you even need integration?

Page 16: Microservices with Apache Camel, Docker and Fabric8 v2

Yes.

Page 17: Microservices with Apache Camel, Docker and Fabric8 v2

17

Enterprise Service Bus?

Page 18: Microservices with Apache Camel, Docker and Fabric8 v2

Hexagonal architecture

Page 19: Microservices with Apache Camel, Docker and Fabric8 v2

Microservices

Page 20: Microservices with Apache Camel, Docker and Fabric8 v2
Page 21: Microservices with Apache Camel, Docker and Fabric8 v2

Real developers ride Camels

Page 22: Microservices with Apache Camel, Docker and Fabric8 v2

Real developers ride Camels!

Page 23: Microservices with Apache Camel, Docker and Fabric8 v2

Enterprise Integration Patterns

http://camel.apache.org/eip

Page 24: Microservices with Apache Camel, Docker and Fabric8 v2

Heavy Lifting: Camel for Microservices

Page 25: Microservices with Apache Camel, Docker and Fabric8 v2

• Dynamic routing options

• REST DSL

• Backpressure mechanisms

• Circuit Breaker

Heavy Lifting: Camel for Microservices

Page 26: Microservices with Apache Camel, Docker and Fabric8 v2

• “Smart endpoints, dumb pipes”• Endpoint does one thing well • Metadata used for further routing• Really “dynamic” with rules engine (eg,

Drools/BRMS)

Dynamic Routing

Page 27: Microservices with Apache Camel, Docker and Fabric8 v2

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”); }}

Page 28: Microservices with Apache Camel, Docker and Fabric8 v2

• 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

Page 29: Microservices with Apache Camel, Docker and Fabric8 v2

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”); }}

Page 30: Microservices with Apache Camel, Docker and Fabric8 v2

More Information

Page 31: Microservices with Apache Camel, Docker and Fabric8 v2

Microservices the Docker way with Fabric8

Page 32: Microservices with Apache Camel, Docker and Fabric8 v2
Page 33: Microservices with Apache Camel, Docker and Fabric8 v2

• 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

Page 34: Microservices with Apache Camel, Docker and Fabric8 v2

• Implemented with Docker and Kubernetes• Use any JVM (or any technology)• Docker images, encourage immutable, well-

defined, well-tested deployments• Provides networking, JVM isolation,

orchestration, auto-scaling, health checks, cloud deployments

Fabric8 V2

Page 35: Microservices with Apache Camel, Docker and Fabric8 v2
Page 36: Microservices with Apache Camel, Docker and Fabric8 v2
Page 37: Microservices with Apache Camel, Docker and Fabric8 v2

• Docker for packaging• Docker/linux containers for process isolation• Kubernetes for container orchestration (start,

stop, health check, replicas, service discovery)• Set of microservices/apps for

• Management• Continuous Delivery• Integration (iPaaS)

• Tools for Java Developers

Fabric8 V2

Page 38: Microservices with Apache Camel, Docker and Fabric8 v2
Page 39: Microservices with Apache Camel, Docker and Fabric8 v2

• Console• Docker Maven Plugin• Fabric8 Maven Plugin• Dependency Injection (of Kube services too!)

• Spring• CDI

• Java Libraries• Kubernetes fluent API• Arquillian plugins • Kubernetes Jolokia

Fabric8 V2

Page 40: Microservices with Apache Camel, Docker and Fabric8 v2

Questions?

Blog: http://blog.christianposta.com

Twitter: @christianposta

Email: [email protected]