SlideShare une entreprise Scribd logo
1  sur  43
Télécharger pour lire hors ligne
Integrating your applications easily
<log id=”ids” message=”rmarting, jromanmartin” />
<log id=”name” message=”Jose Roman Martin Gil” />
<log id=”role” message=”Principal Middleware Architect” />
<log id=”company” message=”Red Hat” />
<log id=”labels” message=”father, husband, friend, runner,
curious, Red Hatter, developer, integrator (in any order)” />
<to uri=”mailto:rmarting@redhat.com” />
<to uri=”GitHub:https://github.com/rmarting” />
<to uri=”Twitter:https://twitter.com/jromanmartin” />
<to uri=”LinkedIn:https://www.linkedin.com/in/jromanmartin/” />
<from uri=”whoami”>
SYSTEM INTEGRATION
System Integration
The process of bringing together the component subsystems into one system
and ensuring that the subsystems function together as a system.
Why Integration?
● Critical for business
● Growth of an enterprise by acquisitions and fusions
● New values are created by combinations of existing products
● Different subsystems use different technologies or languages
● Incremental legacy application replacements
Enterprise Integration Patterns
● Recipes for solving integration problems
● Proven design patterns and recipes for
common integration problems
● Patterns were "Harvested" from a study of
thousands of Integration projects.
● Describes integration problems, solutions and
also provide common vocabulary and diagram
notations
● A book by Gregor Hohpe and Bobby Woolf
○ http:/www.eaipatterns.com
Multiple Integration Styles
TRADITIONAL
INTEGRATION
Pattern-oriented integration
for on-premise and
cloud-based resources.
INTEGRATION
MICROSERVICES
Create and compose
microservices using API and
event-driven interactions.
TRANSITIONAL
INTEGRATION
Blend greenfield and
brownfield to deliver next
generation services.
INTEGRATION FRAMEWORK
Why Integration Framework?
● Don't reinvent the wheel
● It makes your life easier
● As a developer don't have to think about low level code
● Implements common Enterprise Integration Patterns
APACHE CAMEL
What is Apache Camel?
● Versatile Open-Source integration framework based on known Enterprise Integration Patterns
(Apache Camel Web Site)
● Open-Source Java framework that focused on making integration easier and more accessible to
developers. It does this by providing:
○ Concrete implementations of all the widely used EIPS
○ Connectivity to a great variety of transports and APIs,
○ Easy to use Domain Specific Languages (DSLs) to wire EIPs and transports together
Jonathan Anstey (Author Camel in Action)
Apache Camel Provides
200+
COMPONENTS
Batch, messaging,
web services, cloud,
APIs, and more ...
BUILT-IN DATA
TRANSFORMATION
JSON, XML, HL7,
YAML, SOAP, Java,
CSV, Custom
INTUITIVE
FRAMEWORK AND
TOOLING
Build integrations
quickly and easily
without lock-in
ENTERPRISE
INTEGRATION
PATTERNS
Build integrations
using enterprise best
practices.
Create, connect, and
compose APIs with
ease.
NATIVE REST
SUPPORT
APACHE CAMEL ARCHITECTURE
Apache Camel Architecture
Apache Camel Context
● Container of many Camel services, which keeps all the pieces together
Apache Camel Route
● Integration pipeline between an Consumer and Producers
Split
orders
Send
each order
to it’s
process service
Electronics
Others
Customer
Purchase
from("file:work/cbr/input")
.split(xpath("//orders"))
.choice()
.when(xpath("/order:order/order:type = 'E'"))
.to("amqp:queue:electronic/us")
.otherwise()
.recipientList(simple("http4://otherservice"));
Apache Camel Route
Producer
● Produce requests
● End of route
● Dispatching outgoing
requests
Consumer
● Consume requests
● Start of a route
● Dispatching
outgoing replies
Processor
● Intermediate node in
the pipeline
● standard processors
or customized ones
Apache Camel Route - XML vs JavaDSL
<route id="cbr-route">
<from id="_from1" uri="file:work/cbr/input" />
<split id="_split1">
<xpath>//orders</xpath>
<choice id="_choice1">
<when id="_when1">
<xpath>/order:order/order:type=‘E’</xpath>
<to id="_to1" uri="amqp:queue:electronic"/>
<otherwise id="_otherwise1">
<recipientList id="_recipientList1">
<simple>http4://otherservice</simple>
</recipientList>
</choice>
</split>
</route>
from("file:work/cbr/input")
.split(xpath("//orders"))
.choice()
.when(xpath("/order:order/order:type=‘E’"))
.to("amqp:queue:electronic")
.otherwise()
.recipientList(
simple("http4://otherservice"));
Which Camel DSL to Choose and Why?
Apache Camel Endpoint
● Represents endpoint which is capable of sending and receiving (producing
and consuming) messages e.g. FTP server, a Web Service or a JMS broker
● Described by URIs:
○ schema:context/path?options
■ ​schema = identifies component
■ context/path = identifies location of a resource or destination (Configuration)
■ options = setup of properties for component, list of name/value pairs (Parameters)
● Examples:
○ file:inbox/orders?delete=true
○ ftp://john@localhost/ftp?password=nhoj
○ activemq:queue:MyQueue
○ timer://myTimer?period=2000
Apache Camel Endpoint Roles
● Consumer (from)
○ receives messages from an external source and creates a message exchange object,
which the routing rule processes
○ event-driven consumer - waits until message arrives e.g. JMS, HTTP, tcp, udp
○ polling consumer - actively checks for new messages e.g. FTP, file, email
● Producer (to)
○ sends the current message wrapped in the message exchange object to an external
target destination
Apache Camel Message Model
● Message
○ ​basic structure for moving data over a route
○ first created by producer
● Message Exchange - ME
○ ​message container during routing
○ link between producer and consumer
○ Message Exchange Pattern (MEP):
■ InOnly (fire & forget: JMS message)
■ InOut (request-response: HTTP request)
Apache Camel Exchange in Route
PROCESSOR PROCESSOR PROCESSOR
PRODUCER
Exchange
Exchange
In In In
In
Out Out Out
Out
Apache Camel Processor
● Perform actions on the message - modify, use, create, enrich, transform,
validate, intercept, etc.
● Implements the actions of the EIP between the producer/consumer
endpoint
● Processors can be linked in pipeline flow
Apache Camel Component
● Main extension point in Camel
● Contains configurations for Endpoints
● Factory for Endpoint instances
● +200 Endpoint Components
activemq cxf kubernetes jasypt
activemq-journ
al
cxfrs freemarker javaspace
amqp dataset ftp/ftps/sftp jbi
atom db4o gae jcr
bean direct hdfs jdbc
bean
validation
ejb hibernate jetty
browse esper hl7 jms
cache event http jmx
cometd exec ibatis jpa
crypto file irc jt/400
Data Transformation
● ​Data format transformation
○ the data format of message body is transformed from e.g. CSV to formatted
XML
● Data type transformation
○ ​the data type of the message body is transformed
■ java.lang.String -> javax.jms.TextMessage
○ automatic type converter mechanism
● Different Data Formats
○ bindy, csv, json, xml, jaxb, hl7, zip, ...
Converting between Data Format
● Marshal
○ Java Bean → Textual format
● Unmarshal
○ Textual, Binary format → Java Bean
● Dozer
○ Fine-grained integration
○ mapping literal values
○ Use expressions
Sample Data Transformation
Input XML File:
<root>
<child1>text1</child1>
<child2>text2</child2>
</root>
Camel Route:
...
from(“file:///xmlsourcedir”)
.unmarshal().jaxb()
.process(...)
.marshal().json()
.to(“file:///jsondestdir”);
...
Output JSON File:
{"root": {
"child1": "text1",
"child2": "text2"
}
}
Error Handling
● Camel provides Exception Clause to specify error handling per exception type
● Two scopes:
○ global level
○ route specific level
// Generic error handler
errorHandler(deadLetterChannel("errors").maximumRedeliveries(1));
// Special error handling for validation errors
onException(ValidationException.class)
.to("amqp:queue:validation");
from("file:work/cbr/input")
.onException(ShipOrderException.class)
.handled(true)
.bean(ShipService.class, "shipFailed")
.end()
.split(xpath("//orders"))
…;
Security
● Route Security
○ Authentication and Authorization services to proceed on a route or route segment
● Configuration Security
○ Camel allows to crypt/decrypt configuration files containing sensitive information
● Endpoint Security
○ Security offered by components through uri endpointUri associated with the component​
● Payload Security
○ Data Formats that offer encryption/decryption services at the payload level
INTEGRATING APPLICATIONS
API and REST DSL
<camelContext xmlns="http://camel.apache.org/schema/spring">
<rest path="/say">
<get uri="/hello">
<to uri="direct:hello"/>
</get>
<get uri="/bye" consumes="application/json">
<to uri="direct:bye"/>
</get>
<post uri="/bye">
<to uri="mock:update"/>
</post>
</rest>
<route>
<from uri="direct:hello"/> …
</route>
<route>
<from uri="direct:bye"> …
</route>
</camelContext>
Verb
defining
http
method
Basepath
The service
path
Uri template
The service
method and
parameters
Consumes
Accept data format
setting
REST DSL
<restConfiguration bindingMode="auto" component="servlet" port="8080"/>
Message Body Direction Binding Mode Message Body
XML Incoming auto, xml, json_xml POJO
POJO Outgoing auto, xml, json_xml XML
JSON Incoming auto, xml, json_xml POJO
POJO Outgoing auto, xml, json_xml JSON
● camel-netty4-http
● camel-jetty
● camel-servlet
● camel-undertow
Swagger
<restConfiguration apiContextPath="api-docs" bindingMode="json" component="servlet"
contextPath="/demos">
<apiProperty key="cors" value="true"/>
<apiProperty key="api.title" value="API for demo"/>
<apiProperty key="api.version" value="1.0.0"/>
</restConfiguration>
<get uri="/{id}" outType="com.redhat.User">
<description>Find user by id</description>
<param name="id" type="path" description="The id of the user to get" dataType="int"/>
<to uri="bean:userService?method=getUser(${header.id})"/>
</get>
Service Resilience
Apache Camel
microservice
API
Apache Camel
microservice
API
Ruby
microservice
API
.Net
microservice
API
Chain reaction
Spring Boot
microservice
API
SLOW!!
Client
Circuit Breaker
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
<hystrix>
<to uri="http://fooservice.com/slow"/>
<onFallback>
<transform>
<constant>Fallback message</constant>
</transform>
</onFallback>
</hystrix>
<to uri="mock:result"/>
</route>
</camelContext>
Apache Camel
microservice
API
API
Service SaaS
Slow! No
response!
Timeout
Fallback
RUNNING APACHE CAMEL
Deploying Apache Camel
● Standalone JAR
● WAR - Servlet Container, e.g. Apache Tomcat, Jetty
● Spring - Spring Boot
● Java EE - e.g. Wildfly, Glassfish, WebLogic, WebSphere
● OSGi Container - e.g. Apache Karaf, ServiceMix
● Cloud - e.g. OpenShift, Kubernetes, Google Compute Engine, Amazon EC2
Spring Boot vs OSGi
Spring Boot OSGi
Spring DSL/Java
Spring Boot Starter module
Fat JARs
Stand-alone App
Embedded dependency
Pre-configured, pre-sugared
Small and lightweight
Blueprint DSL/Java
Blueprint module
Bundles
Modularized
Explicit dependency
Versioned
Hot redeploy
Linux Container
OS
JVM Linux Container
OS
JVM
Spring Boot
OSGi
More Information
● Camel in Action
● Apache Camel Developer’s Cookbook
● Camel Design Patterns
● Community website
○ http://camel.apache.org/
○ https://github.com/apache/camel
● Spring Boot Sample: https://github.com/rmarting/fis-workshop
Questions?
Thank you!

Contenu connexe

Tendances

SFBigAnalytics_20190724: Monitor kafka like a Pro
SFBigAnalytics_20190724: Monitor kafka like a ProSFBigAnalytics_20190724: Monitor kafka like a Pro
SFBigAnalytics_20190724: Monitor kafka like a Pro
Chester Chen
 
Design and Implementation of Incremental Cooperative Rebalancing
Design and Implementation of Incremental Cooperative RebalancingDesign and Implementation of Incremental Cooperative Rebalancing
Design and Implementation of Incremental Cooperative Rebalancing
confluent
 

Tendances (20)

Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
 
Follow the (Kafka) Streams
Follow the (Kafka) StreamsFollow the (Kafka) Streams
Follow the (Kafka) Streams
 
SFBigAnalytics_20190724: Monitor kafka like a Pro
SFBigAnalytics_20190724: Monitor kafka like a ProSFBigAnalytics_20190724: Monitor kafka like a Pro
SFBigAnalytics_20190724: Monitor kafka like a Pro
 
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
 
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech TalkSpring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
 
Staying on Topic - Invoke OpenFaaS functions with Kafka
Staying on Topic - Invoke OpenFaaS functions with KafkaStaying on Topic - Invoke OpenFaaS functions with Kafka
Staying on Topic - Invoke OpenFaaS functions with Kafka
 
Devops CI-CD pipeline with Containers
Devops CI-CD pipeline with ContainersDevops CI-CD pipeline with Containers
Devops CI-CD pipeline with Containers
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
 
Westpac Bank Tech Talk 1: Dive into Apache Kafka
Westpac Bank Tech Talk 1: Dive into Apache KafkaWestpac Bank Tech Talk 1: Dive into Apache Kafka
Westpac Bank Tech Talk 1: Dive into Apache Kafka
 
Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach i...
Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach i...Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach i...
Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach i...
 
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
 
Serverless Workflow: New approach to Kubernetes service orchestration | DevNa...
Serverless Workflow: New approach to Kubernetes service orchestration | DevNa...Serverless Workflow: New approach to Kubernetes service orchestration | DevNa...
Serverless Workflow: New approach to Kubernetes service orchestration | DevNa...
 
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
 
Gatekeeper: API gateway
Gatekeeper: API gatewayGatekeeper: API gateway
Gatekeeper: API gateway
 
Kafka on Pulsar:bringing native Kafka protocol support to Pulsar_Sijie&Pierre
Kafka on Pulsar:bringing native Kafka protocol support to Pulsar_Sijie&PierreKafka on Pulsar:bringing native Kafka protocol support to Pulsar_Sijie&Pierre
Kafka on Pulsar:bringing native Kafka protocol support to Pulsar_Sijie&Pierre
 
Design and Implementation of Incremental Cooperative Rebalancing
Design and Implementation of Incremental Cooperative RebalancingDesign and Implementation of Incremental Cooperative Rebalancing
Design and Implementation of Incremental Cooperative Rebalancing
 
Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...
Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...
Cross the streams thanks to Kafka and Flink (Christophe Philemotte, Digazu) K...
 
Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...
Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...
Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...
 
A Modern C++ Kafka API | Kenneth Jia, Morgan Stanley
A Modern C++ Kafka API | Kenneth Jia, Morgan StanleyA Modern C++ Kafka API | Kenneth Jia, Morgan Stanley
A Modern C++ Kafka API | Kenneth Jia, Morgan Stanley
 
Tips & Tricks for Apache Kafka®
Tips & Tricks for Apache Kafka®Tips & Tricks for Apache Kafka®
Tips & Tricks for Apache Kafka®
 

Similaire à OpenSouthCode 2018 - Integrating your applications easily with Apache Camel

JSON-RPC Proxy Generation with PHP 5
JSON-RPC Proxy Generation with PHP 5JSON-RPC Proxy Generation with PHP 5
JSON-RPC Proxy Generation with PHP 5
Stephan Schmidt
 

Similaire à OpenSouthCode 2018 - Integrating your applications easily with Apache Camel (20)

Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
 
EIP In Practice
EIP In PracticeEIP In Practice
EIP In Practice
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
AD102 - Break out of the Box
AD102 - Break out of the BoxAD102 - Break out of the Box
AD102 - Break out of the Box
 
Being HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on PurposeBeing HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on Purpose
 
Linked Process
Linked ProcessLinked Process
Linked Process
 
Implementing Messaging Patterns in JavaScript using the OpenAjax Hub
Implementing Messaging Patterns in JavaScript using the OpenAjax HubImplementing Messaging Patterns in JavaScript using the OpenAjax Hub
Implementing Messaging Patterns in JavaScript using the OpenAjax Hub
 
Real world #microservices with Apache Camel, Fabric8, and OpenShift
Real world #microservices with Apache Camel, Fabric8, and OpenShiftReal 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 OpenShiftReal-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
 
Enterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelEnterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache Camel
 
Splunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the message
 
JSON-RPC Proxy Generation with PHP 5
JSON-RPC Proxy Generation with PHP 5JSON-RPC Proxy Generation with PHP 5
JSON-RPC Proxy Generation with PHP 5
 
Red Hat Open Day JBoss Fuse
Red Hat Open Day JBoss FuseRed Hat Open Day JBoss Fuse
Red Hat Open Day JBoss Fuse
 
Django è pronto per l'Enterprise
Django è pronto per l'EnterpriseDjango è pronto per l'Enterprise
Django è pronto per l'Enterprise
 
How bol.com makes sense of its logs, using the Elastic technology stack.
How bol.com makes sense of its logs, using the Elastic technology stack.How bol.com makes sense of its logs, using the Elastic technology stack.
How bol.com makes sense of its logs, using the Elastic technology stack.
 
Red Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop LabsRed Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop Labs
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8
 
CenitHub: Introduction
CenitHub: Introduction CenitHub: Introduction
CenitHub: Introduction
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Synapseindia dot net development web applications with ajax
Synapseindia dot net development  web applications with ajaxSynapseindia dot net development  web applications with ajax
Synapseindia dot net development web applications with ajax
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Dernier (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

OpenSouthCode 2018 - Integrating your applications easily with Apache Camel

  • 2. <log id=”ids” message=”rmarting, jromanmartin” /> <log id=”name” message=”Jose Roman Martin Gil” /> <log id=”role” message=”Principal Middleware Architect” /> <log id=”company” message=”Red Hat” /> <log id=”labels” message=”father, husband, friend, runner, curious, Red Hatter, developer, integrator (in any order)” /> <to uri=”mailto:rmarting@redhat.com” /> <to uri=”GitHub:https://github.com/rmarting” /> <to uri=”Twitter:https://twitter.com/jromanmartin” /> <to uri=”LinkedIn:https://www.linkedin.com/in/jromanmartin/” /> <from uri=”whoami”>
  • 4. System Integration The process of bringing together the component subsystems into one system and ensuring that the subsystems function together as a system.
  • 5. Why Integration? ● Critical for business ● Growth of an enterprise by acquisitions and fusions ● New values are created by combinations of existing products ● Different subsystems use different technologies or languages ● Incremental legacy application replacements
  • 6. Enterprise Integration Patterns ● Recipes for solving integration problems ● Proven design patterns and recipes for common integration problems ● Patterns were "Harvested" from a study of thousands of Integration projects. ● Describes integration problems, solutions and also provide common vocabulary and diagram notations ● A book by Gregor Hohpe and Bobby Woolf ○ http:/www.eaipatterns.com
  • 7. Multiple Integration Styles TRADITIONAL INTEGRATION Pattern-oriented integration for on-premise and cloud-based resources. INTEGRATION MICROSERVICES Create and compose microservices using API and event-driven interactions. TRANSITIONAL INTEGRATION Blend greenfield and brownfield to deliver next generation services.
  • 9. Why Integration Framework? ● Don't reinvent the wheel ● It makes your life easier ● As a developer don't have to think about low level code ● Implements common Enterprise Integration Patterns
  • 11. What is Apache Camel? ● Versatile Open-Source integration framework based on known Enterprise Integration Patterns (Apache Camel Web Site) ● Open-Source Java framework that focused on making integration easier and more accessible to developers. It does this by providing: ○ Concrete implementations of all the widely used EIPS ○ Connectivity to a great variety of transports and APIs, ○ Easy to use Domain Specific Languages (DSLs) to wire EIPs and transports together Jonathan Anstey (Author Camel in Action)
  • 12. Apache Camel Provides 200+ COMPONENTS Batch, messaging, web services, cloud, APIs, and more ... BUILT-IN DATA TRANSFORMATION JSON, XML, HL7, YAML, SOAP, Java, CSV, Custom INTUITIVE FRAMEWORK AND TOOLING Build integrations quickly and easily without lock-in ENTERPRISE INTEGRATION PATTERNS Build integrations using enterprise best practices. Create, connect, and compose APIs with ease. NATIVE REST SUPPORT
  • 15. Apache Camel Context ● Container of many Camel services, which keeps all the pieces together
  • 16. Apache Camel Route ● Integration pipeline between an Consumer and Producers Split orders Send each order to it’s process service Electronics Others Customer Purchase from("file:work/cbr/input") .split(xpath("//orders")) .choice() .when(xpath("/order:order/order:type = 'E'")) .to("amqp:queue:electronic/us") .otherwise() .recipientList(simple("http4://otherservice"));
  • 17. Apache Camel Route Producer ● Produce requests ● End of route ● Dispatching outgoing requests Consumer ● Consume requests ● Start of a route ● Dispatching outgoing replies Processor ● Intermediate node in the pipeline ● standard processors or customized ones
  • 18. Apache Camel Route - XML vs JavaDSL <route id="cbr-route"> <from id="_from1" uri="file:work/cbr/input" /> <split id="_split1"> <xpath>//orders</xpath> <choice id="_choice1"> <when id="_when1"> <xpath>/order:order/order:type=‘E’</xpath> <to id="_to1" uri="amqp:queue:electronic"/> <otherwise id="_otherwise1"> <recipientList id="_recipientList1"> <simple>http4://otherservice</simple> </recipientList> </choice> </split> </route> from("file:work/cbr/input") .split(xpath("//orders")) .choice() .when(xpath("/order:order/order:type=‘E’")) .to("amqp:queue:electronic") .otherwise() .recipientList( simple("http4://otherservice")); Which Camel DSL to Choose and Why?
  • 19. Apache Camel Endpoint ● Represents endpoint which is capable of sending and receiving (producing and consuming) messages e.g. FTP server, a Web Service or a JMS broker ● Described by URIs: ○ schema:context/path?options ■ ​schema = identifies component ■ context/path = identifies location of a resource or destination (Configuration) ■ options = setup of properties for component, list of name/value pairs (Parameters) ● Examples: ○ file:inbox/orders?delete=true ○ ftp://john@localhost/ftp?password=nhoj ○ activemq:queue:MyQueue ○ timer://myTimer?period=2000
  • 20. Apache Camel Endpoint Roles ● Consumer (from) ○ receives messages from an external source and creates a message exchange object, which the routing rule processes ○ event-driven consumer - waits until message arrives e.g. JMS, HTTP, tcp, udp ○ polling consumer - actively checks for new messages e.g. FTP, file, email ● Producer (to) ○ sends the current message wrapped in the message exchange object to an external target destination
  • 21. Apache Camel Message Model ● Message ○ ​basic structure for moving data over a route ○ first created by producer ● Message Exchange - ME ○ ​message container during routing ○ link between producer and consumer ○ Message Exchange Pattern (MEP): ■ InOnly (fire & forget: JMS message) ■ InOut (request-response: HTTP request)
  • 22. Apache Camel Exchange in Route PROCESSOR PROCESSOR PROCESSOR PRODUCER Exchange Exchange In In In In Out Out Out Out
  • 23. Apache Camel Processor ● Perform actions on the message - modify, use, create, enrich, transform, validate, intercept, etc. ● Implements the actions of the EIP between the producer/consumer endpoint ● Processors can be linked in pipeline flow
  • 24. Apache Camel Component ● Main extension point in Camel ● Contains configurations for Endpoints ● Factory for Endpoint instances ● +200 Endpoint Components activemq cxf kubernetes jasypt activemq-journ al cxfrs freemarker javaspace amqp dataset ftp/ftps/sftp jbi atom db4o gae jcr bean direct hdfs jdbc bean validation ejb hibernate jetty browse esper hl7 jms cache event http jmx cometd exec ibatis jpa crypto file irc jt/400
  • 25. Data Transformation ● ​Data format transformation ○ the data format of message body is transformed from e.g. CSV to formatted XML ● Data type transformation ○ ​the data type of the message body is transformed ■ java.lang.String -> javax.jms.TextMessage ○ automatic type converter mechanism ● Different Data Formats ○ bindy, csv, json, xml, jaxb, hl7, zip, ...
  • 26. Converting between Data Format ● Marshal ○ Java Bean → Textual format ● Unmarshal ○ Textual, Binary format → Java Bean ● Dozer ○ Fine-grained integration ○ mapping literal values ○ Use expressions
  • 27. Sample Data Transformation Input XML File: <root> <child1>text1</child1> <child2>text2</child2> </root> Camel Route: ... from(“file:///xmlsourcedir”) .unmarshal().jaxb() .process(...) .marshal().json() .to(“file:///jsondestdir”); ... Output JSON File: {"root": { "child1": "text1", "child2": "text2" } }
  • 28. Error Handling ● Camel provides Exception Clause to specify error handling per exception type ● Two scopes: ○ global level ○ route specific level // Generic error handler errorHandler(deadLetterChannel("errors").maximumRedeliveries(1)); // Special error handling for validation errors onException(ValidationException.class) .to("amqp:queue:validation"); from("file:work/cbr/input") .onException(ShipOrderException.class) .handled(true) .bean(ShipService.class, "shipFailed") .end() .split(xpath("//orders")) …;
  • 29. Security ● Route Security ○ Authentication and Authorization services to proceed on a route or route segment ● Configuration Security ○ Camel allows to crypt/decrypt configuration files containing sensitive information ● Endpoint Security ○ Security offered by components through uri endpointUri associated with the component​ ● Payload Security ○ Data Formats that offer encryption/decryption services at the payload level
  • 31. API and REST DSL <camelContext xmlns="http://camel.apache.org/schema/spring"> <rest path="/say"> <get uri="/hello"> <to uri="direct:hello"/> </get> <get uri="/bye" consumes="application/json"> <to uri="direct:bye"/> </get> <post uri="/bye"> <to uri="mock:update"/> </post> </rest> <route> <from uri="direct:hello"/> … </route> <route> <from uri="direct:bye"> … </route> </camelContext> Verb defining http method Basepath The service path Uri template The service method and parameters Consumes Accept data format setting
  • 32. REST DSL <restConfiguration bindingMode="auto" component="servlet" port="8080"/> Message Body Direction Binding Mode Message Body XML Incoming auto, xml, json_xml POJO POJO Outgoing auto, xml, json_xml XML JSON Incoming auto, xml, json_xml POJO POJO Outgoing auto, xml, json_xml JSON ● camel-netty4-http ● camel-jetty ● camel-servlet ● camel-undertow
  • 33. Swagger <restConfiguration apiContextPath="api-docs" bindingMode="json" component="servlet" contextPath="/demos"> <apiProperty key="cors" value="true"/> <apiProperty key="api.title" value="API for demo"/> <apiProperty key="api.version" value="1.0.0"/> </restConfiguration> <get uri="/{id}" outType="com.redhat.User"> <description>Find user by id</description> <param name="id" type="path" description="The id of the user to get" dataType="int"/> <to uri="bean:userService?method=getUser(${header.id})"/> </get>
  • 34. Service Resilience Apache Camel microservice API Apache Camel microservice API Ruby microservice API .Net microservice API Chain reaction Spring Boot microservice API SLOW!! Client
  • 35. Circuit Breaker <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="direct:start"/> <hystrix> <to uri="http://fooservice.com/slow"/> <onFallback> <transform> <constant>Fallback message</constant> </transform> </onFallback> </hystrix> <to uri="mock:result"/> </route> </camelContext> Apache Camel microservice API API Service SaaS Slow! No response! Timeout Fallback
  • 37. Deploying Apache Camel ● Standalone JAR ● WAR - Servlet Container, e.g. Apache Tomcat, Jetty ● Spring - Spring Boot ● Java EE - e.g. Wildfly, Glassfish, WebLogic, WebSphere ● OSGi Container - e.g. Apache Karaf, ServiceMix ● Cloud - e.g. OpenShift, Kubernetes, Google Compute Engine, Amazon EC2
  • 38. Spring Boot vs OSGi Spring Boot OSGi Spring DSL/Java Spring Boot Starter module Fat JARs Stand-alone App Embedded dependency Pre-configured, pre-sugared Small and lightweight Blueprint DSL/Java Blueprint module Bundles Modularized Explicit dependency Versioned Hot redeploy Linux Container OS JVM Linux Container OS JVM
  • 40. OSGi
  • 41. More Information ● Camel in Action ● Apache Camel Developer’s Cookbook ● Camel Design Patterns ● Community website ○ http://camel.apache.org/ ○ https://github.com/apache/camel ● Spring Boot Sample: https://github.com/rmarting/fis-workshop