© OPITZ CONSULTING 2023 / Öffentlich
Integration architectures with Camel and Quarkus 1
Nuremberg, 2023-11-23
Sven Bernhardt
INTEGRATION ARCHITECTURES
WITH CAMEL AND QUARKUS
© OPITZ CONSULTING 2023 / Öffentlich
THAT‘S ME
Integration architectures with Camel and Quarkus 2
Sven Bernhardt
Cloud-Native enthusiast, API & integration geek. Always curious how new
technologies and concepts can help to make things more valuable and efficient.
@sbernhardt
https://svenbernhardt.wordpress.com/
Chief Architect / Integration Evangelist
OPITZ CONSULTING Deutschland
GmbH
© OPITZ CONSULTING 2023 / Öffentlich
Integration architectures with Camel and Quarkus 3
INTEGRATION – WHY
AND WHAT?
01
ENTERPRISE
INTEGRATION PATTERNS
02
QUARKUS & APACHE
CAMEL
04
APACHE CAMEL
03
CONCLUSION
05
© OPITZ CONSULTING 2023 / Öffentlich
Integration architectures with Camel and Quarkus 4
INTEGRATION – WHY AND WHAT?
01
© OPITZ CONSULTING 2023 / Öffentlich
This is what it looks like sometimes/often/always in application
landscapes...
https://www.youtube.com/watch?v=iXaw70X7wb4&t=2s
Integration architectures with Camel and Quarkus Seite 5
© OPITZ CONSULTING 2023 / Öffentlich
INTEGRATION CHALLENGES ARE MULTIDIMENSIONAL
Integration architectures with Camel and Quarkus 6
© OPITZ CONSULTING 2023 / Öffentlich
LEGACY INTEGRATION WITH MONOLITHIC ESB SOLUTIONS
¢ Monolithic architecture
¢ Often classic JEE deployments
¢ Integrations share single execution process
¢ Limited freedom of technology choice
¢ Core component:
¢ ESB Platform (Oracle Service Bus, Sonic ESB)
¢ Reverse Proxy for handling external traffic
¢ Focus on horizontal integration challenges
Integration architectures with Camel and Quarkus 7
© OPITZ CONSULTING 2023 / Öffentlich
TALKING ABOUT INTEGRATION MEANS TALKING ABOUT VARIOUS
INTEGRATION SCENARIOS AND ASPECTS
Integration architectures with Camel and Quarkus 8
¢ Integration always needs to consider systems, data and processes
¢ Synchronous as well as asynchronous APIs
¢ REST, GraphQL, gRPC, SOAP, WebSockets, Server-Sent Events, Webhooks, etc.
¢ AsyncAPI, CloudEvents, etc.
¢ Data format transformations
¢ Protocol transformations
¢ Batch vs. Near-realtime vs. Streaming
Source: https://www.postman.com/state-of-api/api-technologies/#api-technologies
© OPITZ CONSULTING 2023 / Öffentlich
MOVE TO THE CLOUD AND CLOUD-NATIVE PRINCIPLES FURTHERS
TREND TO DECENTRALIZATION
Integration architectures with Camel and Quarkus 9
Centralized
STATIC
ON-PREM
MONOLITH
VIRTUAL MACHINES
MANUAL CHANGE PROCESS
Decentralized
DYNAMIC
CLOUD / MULTI-CLOUD
MICROSERVICES / SERVERLESS
CONTAINERS, KUBERNETES
AUTOMATED CI/CD TOOL CHAIN
# Services & APIs
CONTROL AND VISIBILITY
© OPITZ CONSULTING 2023 / Öffentlich
INTEGRATION? IT’S JUST ABOUT BOXES AND LINES!
Goals:
¢ Enabling systems to talk to each other
¢ Ensure that data is where it is needed when it is needed in the form in which it is needed
Gregor Hohpe
A small line. That‘s where the beef is!
Integration architectures with Camel and Quarkus 10
© OPITZ CONSULTING 2023 / Öffentlich
INTEGRATION IS BASED ON PATTERNS INDEPENDENT OF TECH
Content-based Router
Message Filter
Splitter
Aggregator
Normalizer
Resequencer
https://www.enterpriseintegrationpatterns.com
Integration architectures with Camel and Quarkus 11
© OPITZ CONSULTING 2023 / Öffentlich
Integration architectures with Camel and Quarkus 12
ENTERPRISE INTEGRATION
PATTERNS
02
© OPITZ CONSULTING 2023 / Öffentlich
INTEGRATION IS BASED ON PATTERNS STABLE FOR DECADES
Content-based Router
Message Filter
Splitter
Aggregator
Normalizer
Resequencer
https://www.enterpriseintegrationpatterns.com
Integration architectures with Camel and Quarkus 13
© OPITZ CONSULTING 2023 / Öffentlich
EIP BASIC CONSTRUCTS
Integration architectures with Camel and Quarkus 14
¢ Message
¢ Wrapper for data
¢ Consists of a header and a body
¢ Endpoint
¢ Endpoints enable systems to interact
¢ Using endpoints systems can exchange
information
¢ Channel
¢ Endpoints publish messages to channels
¢ Listening endpoints consume messages from
a channel
Message
Endpoint
Channel
© OPITZ CONSULTING 2023 / Öffentlich
BASIC IDEA: PIPES AND FILTERS
Integration architectures with Camel and Quarkus 15
¢ Purpose: Divide a larger processing step into
¢ Smaller independent steps (Filters)
¢ Connected by channels (Pipes)
¢ Filters are connected by pipes
¢ General filter flow:
¢ Receive an incoming message from the
inbound pipe
¢ Process message
¢ Publish message to the outbound pipe
Pipes
Filters
© OPITZ CONSULTING 2023 / Öffentlich
MESSAGE TRANSLATOR
Integration architectures with Camel and Quarkus 16
¢ Purpose: Enable systems that use different
data formats to communicate with each
other
¢ Semantic as well as syntactical
transformations are possible:
¢ System-specific objects to domain objects
¢ Protocol transformation: XML to JSON
Source:
https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageTranslator.html
© OPITZ CONSULTING 2023 / Öffentlich
BASIC EIP: MESSAGE ROUTER
Integration architectures with Camel and Quarkus 17
¢ Purpose: Route a message to a recipient
based on the message content
¢ The message is received on an inbound
channel and republished to another channel
depending on a set of conditions
¢ Concrete implementation variants:
¢ Header-based router
¢ Content-based router
Source:
https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageRouter.html
© OPITZ CONSULTING 2023 / Öffentlich
COMBINED EIP: NORMALIZER
Integration architectures with Camel and Quarkus 18
¢ Purpose: Normalize messages that are
semantically equivalent to process them
uniformly
¢ Basic EIP:
¢ Message Router
¢ Message Translator
¢ Messages arrive each in a different format
¢ Depending on the format a message is
forwarded to a specific translator
¢ Normalized messages are published on the
outbound pipe for further processing
Source:
https://www.enterpriseintegrationpatterns.com/patterns/messaging/Normalizer.html
© OPITZ CONSULTING 2023 / Öffentlich
Integration architectures with Camel and Quarkus 19
APACHE CAMEL
03
© OPITZ CONSULTING 2023 / Öffentlich
WHAT IS CAMEL?
Integration architectures with Camel and Quarkus 20
Apache Camel is a
powerful Open Source
Integration Framework
based on
Enterprise Integration Patterns.
© OPITZ CONSULTING 2023 / Öffentlich
CAMEL FACTS
Integration architectures with Camel and Quarkus 21
¢ Use the latests LTS JDK (17)
¢ Camel has also LTS versions (latest LTS: 3.21.x and 4.0.x)
¢ Latest version is Camel 4.2.0
¢ Migrate from javax -> jakarta (JEE 10)
¢ Java 17 minimum, also supports Java 21
¢ Spring Framework 6
¢ Spring Boot 3
¢ Quarkus 3
¢ GitHub statistics:
¢ 5.1k stars
¢ 238 Releases
¢ 1k+ Contributers
© OPITZ CONSULTING 2023 / Öffentlich
APACHE CAMEL HIGH LEVEL ARCHITECTURAL OVERVIEW
Integration architectures with Camel and Quarkus 22
© OPITZ CONSULTING 2023 / Öffentlich
CORE CONCEPT: ROUTE
Integration architectures with Camel and Quarkus 23
¢ Routes decouple clients from servers, and
producers from consumers
¢ Provide a flexible way to implement message
processing logic
¢ Allow independent development of clients
and servers
¢ Allow for clients of servers to be stubbed
out for testing purposes
¢ Partially influence/change routing behavior at
deploy time (if components are available)
¢ Multiple Route DSLs available (XML, Java,
Yaml, Groovy, Kotlin)
© OPITZ CONSULTING 2023 / Öffentlich
THE CAMEL (JAVA) DSL
Integration architectures with Camel and Quarkus 24
¢ Route DSL
¢ from / to / toD
¢ validate()
¢ pipeline() / routingSlip() /
dynamicRouter()
¢ multicast() / recipientList()
¢ choice().when().otherwise():
CBR
¢ process() / transform() / bean:
calling processors
¢ split() / aggregate()
¢ marshal() / unmarshal()
¢ filter()
¢ stop()
¢ loop()
¢ transacted()
¢ log()
¢ onException()
/deadLetterChannel()
¢ doTry() / doCatch()
¢ enrich() / pollEnrich()
¢ throttle()
¢ And more (messageHistory(),
sample(), wireTap(), delay(),
loadBalance(), circuitBreaker(),
serviceCall(), saga(),
claimCheck(), sort(), step(),
thread(), resequencer())
¢ Rest DSL: defining rest
endpoints
¢ Dataformat DSL
¢ dataformat()
¢ csv() / json() / xml()
¢ Component DSL
¢ Endpoint DSL
© OPITZ CONSULTING 2023 / Öffentlich
EXAMPLE: SIMPLEST POSSIBLE ROUTE
Integration architectures with Camel and Quarkus 25
¢ Route consists of endpoints (to/from)
¢ Has a routeId
¢ Can have a description
from("file:/tmp/example/in").routeId("example01").to("file:/tmp/example/out");
from("file:/tmp/example/in")
.routeId("example01")
.description(“move files from inbox to outbox")
.to("file:/tmp/example/out")
© OPITZ CONSULTING 2023 / Öffentlich
ROUTES: TRANSFORMING MESSAGES USING PROCESSORS
Integration architectures with Camel and Quarkus 26
¢ Processors connect endpoints
¢ Used for consuming messages, transforming messages, and implement other use-cases
¢ Are called in a pipeline (one after another) per default (making pipeline() dsl unnecessary)
from("direct:example02").routeId("example02")
.pipeline()
.log("p1: ${body}")
.process(e -> { e.getMessage().setBody(e.getMessage().getBody() + ":added"); })
.log("p2: ${body}")
.end().to("log:demo?plain=true");
from("direct:example02").routeId("example02")
.log("p1: ${body}")
.process(e -> { e.getMessage().setBody(e.getMessage().getBody() + ":added"); })
.log("p2: ${body}")
.to("log:demo?plain=true");
© OPITZ CONSULTING 2023 / Öffentlich
DOCUMENT ROUTES USING EIP DESCRIPTION NOTATION
Integration architectures with Camel and Quarkus 27
¢ For further details visit https://www.enterpriseintegrationpatterns.com/
¢ Message as such is in the focus
¢ Concentrate on the important aspects and applied EIPs
© OPITZ CONSULTING 2023 / Öffentlich
MESSAGE AND EXCHANGE
Integration architectures with Camel and Quarkus 28
¢ An exchange covers the interaction with the
routing engine
¢ Can have properties (a map)
¢ Or special attributes (failed, exception,
transacted, rollbackOnly, fromRouteId,
exchangeId)
¢ The exchange contains a message
¢ A Message has headers
¢ And special attributes (messageId,
messageTimestamp)
¢ Camel is all about on creating, routing and
transforming messages
Exchange
Properties
Message
Headers
Body
© OPITZ CONSULTING 2023 / Öffentlich
MULTICAST: SAME MESSAGE TO MULTIPLE ENDPOINTS
Integration architectures with Camel and Quarkus 29
[ Test worker] example03 INFO p1: example03
[ Test worker] example03 INFO p2: example03
[ Test worker] demo INFO example03
§ Message routed to the last endpoint is the result of the result of the last processor in the
multicast.
§ Order matters, but is deterministic, because endpoints are called sequentially
from("direct:example03").routeId("example03")
.multicast()
.log("p1: ${body}")
.process(e -> { e.getMessage().setBody(e.getMessage().getBody() + ":added"); })
.log("p2: ${body}")
.end().to("log:demo?plain=true");
© OPITZ CONSULTING 2023 / Öffentlich
MULTICAST: ORDER MATTERS
Integration architectures with Camel and Quarkus 30
[ Test worker] example03a INFO p1: example03a
[ Test worker] example03a INFO p2: example03a
[ Test worker] demo INFO example03a:added
If you want to work on the results, you should define an AggregationStrategy (later lab04)
from("direct:example03a").routeId("example03a")
.multicast()
.log("p1: ${body}")
.log("p2: ${body}")
.process(e -> { e.getMessage().setBody(e.getMessage().getBody() + ":added"); })
.end().to("log:demo?plain=true");
© OPITZ CONSULTING 2023 / Öffentlich
MULTICAST: PARALLELIZING
Integration architectures with Camel and Quarkus 31
[(lab_01) thread #6 - Multicast] example04 INFO p2: example04
[(lab_01) thread #2 - Multicast] example04 INFO p1: example04
[(lab_01) thread #2 - Multicast] demo INFO example04
(lab_01) thread #2 - Multicast] example04 INFO p1: example04
[(lab_01) thread #6 - Multicast] example04 INFO p2: example04
[(lab_01) thread #6 - Multicast] demo INFO example04
from("direct:example04").routeId("example04")
.multicast().parallelProcessing()
.log("p1: ${body}")
.process(e -> { e.getMessage().setBody(e.getMessage().getBody() + ":added"); })
.log("p2: ${body}")
.end().to("log:demo?plain=true");
© OPITZ CONSULTING 2023 / Öffentlich
COMPONENTS
Integration architectures with Camel and Quarkus 32
¢ Different types
¢ Consumers (from)
¢ Producers (to)
¢ Or both
¢ Core: 24 in 21 jar artifacts (4.0-M2)
¢ Non-core: 302 in 238 (4.0-M2)
¢ No need to know all non-core components
¢ You need to know there is a lot to use…
before implementing your own
¢ Many components to provide connectivity
and solutions to different problems
¢ You do not need to know all, but understand
the most relevant ones
¢ File
¢ Database Connectivity (SQL / JPA / Jooq)
¢ Messaging (Kafka, JMS)
¢ REST endpoints and clients
¢ See: list of core components
https://camel.apache.org/components/3.20.x/
index.html
© OPITZ CONSULTING 2023 / Öffentlich
Integration architectures with Camel and Quarkus 33
QUARKUS & APACHE CAMEL
04
© OPITZ CONSULTING 2023 / Öffentlich
WHAT IS QUARKUS?
Integration architectures with Camel and Quarkus 34
A Kubernetes Native Java stack
tailored for OpenJDK HotSpot and
GraalVM, crafted from the best-of-
breed Java libraries and standards.
© OPITZ CONSULTING 2023 / Öffentlich
QUARKUS FACTS
Integration architectures with Camel and Quarkus 35
¢ Supports Java 11, 17 and 21
¢ GraalVM Support
¢ Current version: Quarkus 3.5.x, current LTS release: Quarkus 3.2.x
¢ Characteristics:
¢ Container-first mindset
¢ Reactive
¢ Kubernetes-native framework
¢ Build upon standards (Jakarta EE, Microprofile, OpenTelemetry)
¢ GitHub statistics:
¢ 12.6k stars
¢ 273 Releases
¢ 873 Contributors
© OPITZ CONSULTING 2023 / Öffentlich
QUARKUS & APACHE CAMEL
Integration architectures with Camel and Quarkus 36
¢ Best from two worlds
¢ Rich integration capabilities of Apache Camel
¢ Strengths of the Quarkus runtime
¢ Build Cloud-native integration solutions
Source: https://camel.apache.org/camel-quarkus/3.5.x/
© OPITZ CONSULTING 2023 / Öffentlich
Integration architectures with Camel and Quarkus 37
CONCLUSION
05
© OPITZ CONSULTING 2023 / Öffentlich
CAMEL AND QUARKUS: A MATCH MADE IN HEAVEN FOR CLOUD-
NATIVE INTEGRATION SOLUTIONS!
Integration architectures with Camel and Quarkus 38
¢ Without understanding the basic concepts it is harder to dig into Apache Camel
¢ Grown framework
¢ Rich functionalities
¢ A great ecosystem of components (which may be scary for newbies)
¢ Quarkus is a great runtime to efficiently bring Camel to Containers (Spring Boot as an
alternative)
¢ Easy to get started
¢ Good documentation
¢ Proven frameworks with an active community
¢ Combination of both frameworks provides great flexibility and productivity
© OPITZ CONSULTING 2023 / Öffentlich
WHAT WE LEARNED?
Integration architectures with Camel and Quarkus 39
¢ Camel helps to consistently implement
Enterprise Integration Patterns
¢ Camel is about routing messages
© OPITZ CONSULTING 2023 / Öffentlich
Integration architectures with Camel and Quarkus 40
Q & A
© OPITZ CONSULTING 2023 / Öffentlich
SOME HELPFUL REFERENCES
Integration architectures with Camel and Quarkus 41
© OPITZ CONSULTING 2023 / Öffentlich
INTEGRATION IS THE FOUNDATION FOR IT-MODERNIZATION
Integration architectures with Camel and Quarkus
Sven Bernhardt
Chief Architect
sven.bernhardt@opitz-
consulting.com
www.opitz-consulting.com
Thanks for your attention!
Questions left? Contact me!
42

Effective and simple - integration architectures with Apache Camel and Quarkus

  • 1.
    © OPITZ CONSULTING2023 / Öffentlich Integration architectures with Camel and Quarkus 1 Nuremberg, 2023-11-23 Sven Bernhardt INTEGRATION ARCHITECTURES WITH CAMEL AND QUARKUS
  • 2.
    © OPITZ CONSULTING2023 / Öffentlich THAT‘S ME Integration architectures with Camel and Quarkus 2 Sven Bernhardt Cloud-Native enthusiast, API & integration geek. Always curious how new technologies and concepts can help to make things more valuable and efficient. @sbernhardt https://svenbernhardt.wordpress.com/ Chief Architect / Integration Evangelist OPITZ CONSULTING Deutschland GmbH
  • 3.
    © OPITZ CONSULTING2023 / Öffentlich Integration architectures with Camel and Quarkus 3 INTEGRATION – WHY AND WHAT? 01 ENTERPRISE INTEGRATION PATTERNS 02 QUARKUS & APACHE CAMEL 04 APACHE CAMEL 03 CONCLUSION 05
  • 4.
    © OPITZ CONSULTING2023 / Öffentlich Integration architectures with Camel and Quarkus 4 INTEGRATION – WHY AND WHAT? 01
  • 5.
    © OPITZ CONSULTING2023 / Öffentlich This is what it looks like sometimes/often/always in application landscapes... https://www.youtube.com/watch?v=iXaw70X7wb4&t=2s Integration architectures with Camel and Quarkus Seite 5
  • 6.
    © OPITZ CONSULTING2023 / Öffentlich INTEGRATION CHALLENGES ARE MULTIDIMENSIONAL Integration architectures with Camel and Quarkus 6
  • 7.
    © OPITZ CONSULTING2023 / Öffentlich LEGACY INTEGRATION WITH MONOLITHIC ESB SOLUTIONS ¢ Monolithic architecture ¢ Often classic JEE deployments ¢ Integrations share single execution process ¢ Limited freedom of technology choice ¢ Core component: ¢ ESB Platform (Oracle Service Bus, Sonic ESB) ¢ Reverse Proxy for handling external traffic ¢ Focus on horizontal integration challenges Integration architectures with Camel and Quarkus 7
  • 8.
    © OPITZ CONSULTING2023 / Öffentlich TALKING ABOUT INTEGRATION MEANS TALKING ABOUT VARIOUS INTEGRATION SCENARIOS AND ASPECTS Integration architectures with Camel and Quarkus 8 ¢ Integration always needs to consider systems, data and processes ¢ Synchronous as well as asynchronous APIs ¢ REST, GraphQL, gRPC, SOAP, WebSockets, Server-Sent Events, Webhooks, etc. ¢ AsyncAPI, CloudEvents, etc. ¢ Data format transformations ¢ Protocol transformations ¢ Batch vs. Near-realtime vs. Streaming Source: https://www.postman.com/state-of-api/api-technologies/#api-technologies
  • 9.
    © OPITZ CONSULTING2023 / Öffentlich MOVE TO THE CLOUD AND CLOUD-NATIVE PRINCIPLES FURTHERS TREND TO DECENTRALIZATION Integration architectures with Camel and Quarkus 9 Centralized STATIC ON-PREM MONOLITH VIRTUAL MACHINES MANUAL CHANGE PROCESS Decentralized DYNAMIC CLOUD / MULTI-CLOUD MICROSERVICES / SERVERLESS CONTAINERS, KUBERNETES AUTOMATED CI/CD TOOL CHAIN # Services & APIs CONTROL AND VISIBILITY
  • 10.
    © OPITZ CONSULTING2023 / Öffentlich INTEGRATION? IT’S JUST ABOUT BOXES AND LINES! Goals: ¢ Enabling systems to talk to each other ¢ Ensure that data is where it is needed when it is needed in the form in which it is needed Gregor Hohpe A small line. That‘s where the beef is! Integration architectures with Camel and Quarkus 10
  • 11.
    © OPITZ CONSULTING2023 / Öffentlich INTEGRATION IS BASED ON PATTERNS INDEPENDENT OF TECH Content-based Router Message Filter Splitter Aggregator Normalizer Resequencer https://www.enterpriseintegrationpatterns.com Integration architectures with Camel and Quarkus 11
  • 12.
    © OPITZ CONSULTING2023 / Öffentlich Integration architectures with Camel and Quarkus 12 ENTERPRISE INTEGRATION PATTERNS 02
  • 13.
    © OPITZ CONSULTING2023 / Öffentlich INTEGRATION IS BASED ON PATTERNS STABLE FOR DECADES Content-based Router Message Filter Splitter Aggregator Normalizer Resequencer https://www.enterpriseintegrationpatterns.com Integration architectures with Camel and Quarkus 13
  • 14.
    © OPITZ CONSULTING2023 / Öffentlich EIP BASIC CONSTRUCTS Integration architectures with Camel and Quarkus 14 ¢ Message ¢ Wrapper for data ¢ Consists of a header and a body ¢ Endpoint ¢ Endpoints enable systems to interact ¢ Using endpoints systems can exchange information ¢ Channel ¢ Endpoints publish messages to channels ¢ Listening endpoints consume messages from a channel Message Endpoint Channel
  • 15.
    © OPITZ CONSULTING2023 / Öffentlich BASIC IDEA: PIPES AND FILTERS Integration architectures with Camel and Quarkus 15 ¢ Purpose: Divide a larger processing step into ¢ Smaller independent steps (Filters) ¢ Connected by channels (Pipes) ¢ Filters are connected by pipes ¢ General filter flow: ¢ Receive an incoming message from the inbound pipe ¢ Process message ¢ Publish message to the outbound pipe Pipes Filters
  • 16.
    © OPITZ CONSULTING2023 / Öffentlich MESSAGE TRANSLATOR Integration architectures with Camel and Quarkus 16 ¢ Purpose: Enable systems that use different data formats to communicate with each other ¢ Semantic as well as syntactical transformations are possible: ¢ System-specific objects to domain objects ¢ Protocol transformation: XML to JSON Source: https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageTranslator.html
  • 17.
    © OPITZ CONSULTING2023 / Öffentlich BASIC EIP: MESSAGE ROUTER Integration architectures with Camel and Quarkus 17 ¢ Purpose: Route a message to a recipient based on the message content ¢ The message is received on an inbound channel and republished to another channel depending on a set of conditions ¢ Concrete implementation variants: ¢ Header-based router ¢ Content-based router Source: https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageRouter.html
  • 18.
    © OPITZ CONSULTING2023 / Öffentlich COMBINED EIP: NORMALIZER Integration architectures with Camel and Quarkus 18 ¢ Purpose: Normalize messages that are semantically equivalent to process them uniformly ¢ Basic EIP: ¢ Message Router ¢ Message Translator ¢ Messages arrive each in a different format ¢ Depending on the format a message is forwarded to a specific translator ¢ Normalized messages are published on the outbound pipe for further processing Source: https://www.enterpriseintegrationpatterns.com/patterns/messaging/Normalizer.html
  • 19.
    © OPITZ CONSULTING2023 / Öffentlich Integration architectures with Camel and Quarkus 19 APACHE CAMEL 03
  • 20.
    © OPITZ CONSULTING2023 / Öffentlich WHAT IS CAMEL? Integration architectures with Camel and Quarkus 20 Apache Camel is a powerful Open Source Integration Framework based on Enterprise Integration Patterns.
  • 21.
    © OPITZ CONSULTING2023 / Öffentlich CAMEL FACTS Integration architectures with Camel and Quarkus 21 ¢ Use the latests LTS JDK (17) ¢ Camel has also LTS versions (latest LTS: 3.21.x and 4.0.x) ¢ Latest version is Camel 4.2.0 ¢ Migrate from javax -> jakarta (JEE 10) ¢ Java 17 minimum, also supports Java 21 ¢ Spring Framework 6 ¢ Spring Boot 3 ¢ Quarkus 3 ¢ GitHub statistics: ¢ 5.1k stars ¢ 238 Releases ¢ 1k+ Contributers
  • 22.
    © OPITZ CONSULTING2023 / Öffentlich APACHE CAMEL HIGH LEVEL ARCHITECTURAL OVERVIEW Integration architectures with Camel and Quarkus 22
  • 23.
    © OPITZ CONSULTING2023 / Öffentlich CORE CONCEPT: ROUTE Integration architectures with Camel and Quarkus 23 ¢ Routes decouple clients from servers, and producers from consumers ¢ Provide a flexible way to implement message processing logic ¢ Allow independent development of clients and servers ¢ Allow for clients of servers to be stubbed out for testing purposes ¢ Partially influence/change routing behavior at deploy time (if components are available) ¢ Multiple Route DSLs available (XML, Java, Yaml, Groovy, Kotlin)
  • 24.
    © OPITZ CONSULTING2023 / Öffentlich THE CAMEL (JAVA) DSL Integration architectures with Camel and Quarkus 24 ¢ Route DSL ¢ from / to / toD ¢ validate() ¢ pipeline() / routingSlip() / dynamicRouter() ¢ multicast() / recipientList() ¢ choice().when().otherwise(): CBR ¢ process() / transform() / bean: calling processors ¢ split() / aggregate() ¢ marshal() / unmarshal() ¢ filter() ¢ stop() ¢ loop() ¢ transacted() ¢ log() ¢ onException() /deadLetterChannel() ¢ doTry() / doCatch() ¢ enrich() / pollEnrich() ¢ throttle() ¢ And more (messageHistory(), sample(), wireTap(), delay(), loadBalance(), circuitBreaker(), serviceCall(), saga(), claimCheck(), sort(), step(), thread(), resequencer()) ¢ Rest DSL: defining rest endpoints ¢ Dataformat DSL ¢ dataformat() ¢ csv() / json() / xml() ¢ Component DSL ¢ Endpoint DSL
  • 25.
    © OPITZ CONSULTING2023 / Öffentlich EXAMPLE: SIMPLEST POSSIBLE ROUTE Integration architectures with Camel and Quarkus 25 ¢ Route consists of endpoints (to/from) ¢ Has a routeId ¢ Can have a description from("file:/tmp/example/in").routeId("example01").to("file:/tmp/example/out"); from("file:/tmp/example/in") .routeId("example01") .description(“move files from inbox to outbox") .to("file:/tmp/example/out")
  • 26.
    © OPITZ CONSULTING2023 / Öffentlich ROUTES: TRANSFORMING MESSAGES USING PROCESSORS Integration architectures with Camel and Quarkus 26 ¢ Processors connect endpoints ¢ Used for consuming messages, transforming messages, and implement other use-cases ¢ Are called in a pipeline (one after another) per default (making pipeline() dsl unnecessary) from("direct:example02").routeId("example02") .pipeline() .log("p1: ${body}") .process(e -> { e.getMessage().setBody(e.getMessage().getBody() + ":added"); }) .log("p2: ${body}") .end().to("log:demo?plain=true"); from("direct:example02").routeId("example02") .log("p1: ${body}") .process(e -> { e.getMessage().setBody(e.getMessage().getBody() + ":added"); }) .log("p2: ${body}") .to("log:demo?plain=true");
  • 27.
    © OPITZ CONSULTING2023 / Öffentlich DOCUMENT ROUTES USING EIP DESCRIPTION NOTATION Integration architectures with Camel and Quarkus 27 ¢ For further details visit https://www.enterpriseintegrationpatterns.com/ ¢ Message as such is in the focus ¢ Concentrate on the important aspects and applied EIPs
  • 28.
    © OPITZ CONSULTING2023 / Öffentlich MESSAGE AND EXCHANGE Integration architectures with Camel and Quarkus 28 ¢ An exchange covers the interaction with the routing engine ¢ Can have properties (a map) ¢ Or special attributes (failed, exception, transacted, rollbackOnly, fromRouteId, exchangeId) ¢ The exchange contains a message ¢ A Message has headers ¢ And special attributes (messageId, messageTimestamp) ¢ Camel is all about on creating, routing and transforming messages Exchange Properties Message Headers Body
  • 29.
    © OPITZ CONSULTING2023 / Öffentlich MULTICAST: SAME MESSAGE TO MULTIPLE ENDPOINTS Integration architectures with Camel and Quarkus 29 [ Test worker] example03 INFO p1: example03 [ Test worker] example03 INFO p2: example03 [ Test worker] demo INFO example03 § Message routed to the last endpoint is the result of the result of the last processor in the multicast. § Order matters, but is deterministic, because endpoints are called sequentially from("direct:example03").routeId("example03") .multicast() .log("p1: ${body}") .process(e -> { e.getMessage().setBody(e.getMessage().getBody() + ":added"); }) .log("p2: ${body}") .end().to("log:demo?plain=true");
  • 30.
    © OPITZ CONSULTING2023 / Öffentlich MULTICAST: ORDER MATTERS Integration architectures with Camel and Quarkus 30 [ Test worker] example03a INFO p1: example03a [ Test worker] example03a INFO p2: example03a [ Test worker] demo INFO example03a:added If you want to work on the results, you should define an AggregationStrategy (later lab04) from("direct:example03a").routeId("example03a") .multicast() .log("p1: ${body}") .log("p2: ${body}") .process(e -> { e.getMessage().setBody(e.getMessage().getBody() + ":added"); }) .end().to("log:demo?plain=true");
  • 31.
    © OPITZ CONSULTING2023 / Öffentlich MULTICAST: PARALLELIZING Integration architectures with Camel and Quarkus 31 [(lab_01) thread #6 - Multicast] example04 INFO p2: example04 [(lab_01) thread #2 - Multicast] example04 INFO p1: example04 [(lab_01) thread #2 - Multicast] demo INFO example04 (lab_01) thread #2 - Multicast] example04 INFO p1: example04 [(lab_01) thread #6 - Multicast] example04 INFO p2: example04 [(lab_01) thread #6 - Multicast] demo INFO example04 from("direct:example04").routeId("example04") .multicast().parallelProcessing() .log("p1: ${body}") .process(e -> { e.getMessage().setBody(e.getMessage().getBody() + ":added"); }) .log("p2: ${body}") .end().to("log:demo?plain=true");
  • 32.
    © OPITZ CONSULTING2023 / Öffentlich COMPONENTS Integration architectures with Camel and Quarkus 32 ¢ Different types ¢ Consumers (from) ¢ Producers (to) ¢ Or both ¢ Core: 24 in 21 jar artifacts (4.0-M2) ¢ Non-core: 302 in 238 (4.0-M2) ¢ No need to know all non-core components ¢ You need to know there is a lot to use… before implementing your own ¢ Many components to provide connectivity and solutions to different problems ¢ You do not need to know all, but understand the most relevant ones ¢ File ¢ Database Connectivity (SQL / JPA / Jooq) ¢ Messaging (Kafka, JMS) ¢ REST endpoints and clients ¢ See: list of core components https://camel.apache.org/components/3.20.x/ index.html
  • 33.
    © OPITZ CONSULTING2023 / Öffentlich Integration architectures with Camel and Quarkus 33 QUARKUS & APACHE CAMEL 04
  • 34.
    © OPITZ CONSULTING2023 / Öffentlich WHAT IS QUARKUS? Integration architectures with Camel and Quarkus 34 A Kubernetes Native Java stack tailored for OpenJDK HotSpot and GraalVM, crafted from the best-of- breed Java libraries and standards.
  • 35.
    © OPITZ CONSULTING2023 / Öffentlich QUARKUS FACTS Integration architectures with Camel and Quarkus 35 ¢ Supports Java 11, 17 and 21 ¢ GraalVM Support ¢ Current version: Quarkus 3.5.x, current LTS release: Quarkus 3.2.x ¢ Characteristics: ¢ Container-first mindset ¢ Reactive ¢ Kubernetes-native framework ¢ Build upon standards (Jakarta EE, Microprofile, OpenTelemetry) ¢ GitHub statistics: ¢ 12.6k stars ¢ 273 Releases ¢ 873 Contributors
  • 36.
    © OPITZ CONSULTING2023 / Öffentlich QUARKUS & APACHE CAMEL Integration architectures with Camel and Quarkus 36 ¢ Best from two worlds ¢ Rich integration capabilities of Apache Camel ¢ Strengths of the Quarkus runtime ¢ Build Cloud-native integration solutions Source: https://camel.apache.org/camel-quarkus/3.5.x/
  • 37.
    © OPITZ CONSULTING2023 / Öffentlich Integration architectures with Camel and Quarkus 37 CONCLUSION 05
  • 38.
    © OPITZ CONSULTING2023 / Öffentlich CAMEL AND QUARKUS: A MATCH MADE IN HEAVEN FOR CLOUD- NATIVE INTEGRATION SOLUTIONS! Integration architectures with Camel and Quarkus 38 ¢ Without understanding the basic concepts it is harder to dig into Apache Camel ¢ Grown framework ¢ Rich functionalities ¢ A great ecosystem of components (which may be scary for newbies) ¢ Quarkus is a great runtime to efficiently bring Camel to Containers (Spring Boot as an alternative) ¢ Easy to get started ¢ Good documentation ¢ Proven frameworks with an active community ¢ Combination of both frameworks provides great flexibility and productivity
  • 39.
    © OPITZ CONSULTING2023 / Öffentlich WHAT WE LEARNED? Integration architectures with Camel and Quarkus 39 ¢ Camel helps to consistently implement Enterprise Integration Patterns ¢ Camel is about routing messages
  • 40.
    © OPITZ CONSULTING2023 / Öffentlich Integration architectures with Camel and Quarkus 40 Q & A
  • 41.
    © OPITZ CONSULTING2023 / Öffentlich SOME HELPFUL REFERENCES Integration architectures with Camel and Quarkus 41
  • 42.
    © OPITZ CONSULTING2023 / Öffentlich INTEGRATION IS THE FOUNDATION FOR IT-MODERNIZATION Integration architectures with Camel and Quarkus Sven Bernhardt Chief Architect sven.bernhardt@opitz- consulting.com www.opitz-consulting.com Thanks for your attention! Questions left? Contact me! 42