Apache Camel K

Integrating systems

in the age of

Quarkus, Knative and Kafka Connect

 

Peter Palaga

@ppalaga

 

My main job:

Camel Quarkus

porting Camel componets to Quarkus

mvnd - the Maven Daemon

https://github.com/mvndaemon/mvnd

Twitter

Agenda

  • Apache Camel intro
  • Camel on Quarkus
  • Camel on Knative/Kubernetes
  • Camel on Kafka Connect

What is Apache Camel?

http://camel.apache.org/
Apache Camel is...

An integration library



Systems integration
Apache Camel is based on

Enterprise Integration Patterns (EIP)

EIPs
https://www.enterpriseintegrationpatterns.com/
Apache Camel can...

integrate anything

through its

360+ components

Filetypes:

  • Plaintext, XML, HTML, CSV, JSON, ZIP, ...
  • Apache Tika (MS Office, OpenDocument, ...)

Protocols:

  • TCP/UDP, DNS, FTP, HTTP, IRC, SSH, ...
  • REST, GRPC, git, ...
  • IoT: CoAP, MQTT, PubNub

Public/private Clouds:   

  • AWS: S3, SQS, Kinesis, ...
  • Azure: Blob, Queue, ...
  • Google: BigQuery, PubSub
  • DigitalOcean, Kubernetes, OpenShift, etcd, Docker

Data & messaging

  • Hazelcast, Infinispan, Redis, ...
  • Cassandra, MongoDB
  • JDBC, SQL, JPA
  • Kafka, Debezium
  • JMS, AMQP, QPID, STOMP

APIs:

  • Social: Facebook, Twitter, LinkedIn
  • Box, Dropbox, Google Calendar/Drive/Mail/Docs
  • Salesforce, SAP, ServiceNow, FHIR
  • GitHub, Jira, Telegram

Misc:

  • Barcode
  • Base64, JsonPath, Freemarker, Groovy, Mustache, Ruby
  • JMX, OpenTelemetry, OpenTracing, OptaPlanner, Syslog

... and many more

Routes defined via

Domain Specific Languages (DSL)

Java XML
class MyCamelRouter extends RouteBuilder {
  @Override
  public void configure() throws Exception {
    from("aws2-s3://my-bucket?prefix=hello.txt")
      .log("Got an S3 file: ${body}")
      .to("telegram:bots");
  }
}
<routes
  xmlns="http://camel.apache.org/schema/spring">
  <route id="my-route">
    <from uri="aws2-s3://my-bucket?prefix=hello.txt"/>
    <log message="Got an S3 file: ${body}"/>
    <to uri="telegram:bots"/>
  </route>
</routes>

Groovy, Scala, Kotlin, YAML, ...

Apache Camel is...

Runnable on


Standalone
Spring Boot Spring Boot Apache Karaf WildFly
Quarkus Apache Karaf Knative/Kubernetes WildFly
Image from pxhere.com CC0 Public Domain

Camel on Quarkus

a build time toolkit

Why Camel on Quarkus?

 

πŸ’Ύ Small size on disk βœ“ Small container images
πŸš€ Fast boot time βœ“ Instant scale up
πŸ”¬ Low memory footprint βœ“ More containers with the same amount of RAM
Why Quarkus?

Developer joy

  • Live reload:
    mvn compile quarkus:dev
  • Isolation from GraalVM CLI/SPI config
  • Rich ecosystem of extensions

Camel Quarkus

Camel Quarkus Demo



Demo code:
github.com/ppalaga/camel-quarkus-cnorris-demo

How can we deploy on Kubernetes?

Provided by Quarkus

  • Build and push an image
    • quarkus-container-image-jib
    • quarkus-container-image-docker
    • quarkus-container-image-s2i

  • Generate Kubernetes resources
    • quarkus-kubernetes
    • quarkus-minikube
    • quarkus-openshift
    • quarkus-kubernetes-config


Watch Quarkus Insights #15: Kubernetes and OpenShift with Quarkus

How fast can you (re-)deploy?

  • Jib (minimal app):
    • ~10s with local Docker daemon
    • add 3+ seconds with remote registry
    • add 3+ seconds to redeploy inside the cluster

  • OpenShift s2i: ~1 min
Can we do better?

Camel K

Image by Anders Lanzen CC BY-NC-SA 2.0

Camel K overview

Camel K demo

https://github.com/ppalaga/camel-quarkus-cnorris-demo

How Camel K works

Camel K internals

Knative

  • Building blocks for Serverless applications
  • CRDs and operators

https://knative.dev

Camel

Knative Serving

Knative Eventing

https://cloudevents.io

Camel as

Knative event source



Camel as

Knative event sink



Camel as

Knative Event Router



Camel
Kafka
Connector

Image from pxhere.com CC0 Public Domain
  • A stream-processing platform
  • Distributed, scalable, fault-tolerant, fast

Apache Kafka APIs

  • Producer API - publish records to topics
  • Consumer API - subscribe to topics to consume records
  • Streams API - act as a stream processor/transformer
  • Connector API, a.k.a. Kafka Connect

Kafka Connect

Stream data between Apache Kafka and other systems

  • A framework to write Connectors
  • A runtime to run them
    • Distributed or standalone
    • Automatic offset management
    • REST API to manage connectors

Camel Kafka Connector

Minimal (code-less) configuration

350+ Camel components supported

Wrap up

  • Apache πŸͺ = an integration lib with 360+ connectors
  • πŸš€πŸ”¬ on Quarkus
  • Producer/Consumer/Router, scale to 0️⃣ on Knative
  • Stream data from/to Kafka