SlideShare a Scribd company logo
Introduction to Kafka
with Spring Integration
Introduction to Kafka with Spring
Integration
• Kafka (Mihail Yordanov)
• Spring integration (Borislav Markov)
• Students Example (Mihail & Borislav)
• Conclusion
Motivation
• Real time data being continuously generated
• Producers and consumers relationships
• Streaming systems
• Messaging systems
Apache Kafka
• Developed by LinkedIn
• “We built Apache Kafka at LinkedIn with a specific
purpose in mind: to serve as a central repository of
data streams.” - Jay Kreps
• Kafka improvements
– Transporting data between systems
– Richer analytical processing
• “A publish-subscribe messaging system rethought as a
distributed commit log”
Kafka Vocabulary
• Brokers
• Producers
• Consumers
• “A publish-subscribe messaging system
rethought as a distributed commit log”
Kafka Vocabulary
• Topics
• Partitions
• “A publish-subscribe messaging system rethought
as a distributed commit log”
Kafka Speed
Kafka Speed
Kafka Speed
Consumer groups
• Definition - “A publish-subscribe messaging
system rethought as a distributed commit log”
• Publish - Subscribe
• Queueing
Spring Integration
• Spring Integration enables lightweight
messaging
• Supports integration with external systems via
declarative adapters
• Primary goal is to provide a simple model for
building enterprise integration solutions
• Separation of concerns
• Maintainable, testable code
Features
• Implementation of most of the Enterprise Integration Patterns
• Endpoint
• Channel (Point-to-point and Publish/Subscribe)
• Aggregator
• Filter
• Transformer
• Control Bus
• …
• Integration with External Systems
• ReST/HTTP
• ...
The theory...
The patterns can be found at
http://www.enterpriseintegrationpatterns.com/patterns/messag
ing/index.html
Message
• Messages are objects that carry information between two applications
• They are constructed by the producer and they are consumed/deconstructed at
the consumer/subscriber
• Message consists of:
– payload
– header
public interface Message<T> {
T getPayload();
MessageHeaders getHeaders();
}
Message endpoints
Common endpoints:
• Service Activator - invokes a method on a
bean
• Message Bridge - couples different
messaging modes/adapters. Example: (P2P
with Publish/Subscribe)
• Message Enricher - enrich the incoming
message with additional information.
– Header Enricher - add header
attributes
– Payload Enricher - enrich payload
Message endpoints (continued)
• Gateway - Used when we don’t have knowledge for the
messaging system.
– Synchronous Gateway - void or returns T
– Asynchronous Gateway - returns Future<T>
• Delayer - introduce delay between sender and receiver
• Consumers
– Polling Consumers - poll messages in a timely fashion
– Polling Using Triggers - poll messages with PeriodicTrigger
and with CronTrigger
– Event-Driven Consumers - they wait for someone to
deliver the message (framework’s responsibility)
Message endpoints (continued)
• Channel Adapter - endpoint that connects a Message Channel
to some other system or transport.
–inbound
–outbound
Message Channels
• interface MessageChannel
– boolean send(Message<?> message);
– boolean send(Message<?> message, long timeout);
• Point-to-Point Mode -> PollableChannel
– Message<?> receive();
– Message<?> receive(long timeout);
• Publish/Subscribe Mode -> SubscribableChannel
– boolean subscribe(MessageHandler handler);
– boolean unsubscribe(MessageHandler handler);
Message Channels(continued)
•Queue Channel - has capacity
•Priority Channel - queue channel with
prioritization
•PublishSubscribe Channel
•DirectChannel - mixed type P2P and
Pub/Sub
Message Channels(continued)
Flow components
• Filters
– Custom filters are tied to the framework, can
be bean method returning boolean
– Framework MessageSelector - use of method
boolean accept(Message m)
– Using annotation - @Filter
• Routers
– PayloadTypeRouter
– HeaderValueRouter
– Custom Routers - any bean method can be
router, the result will be the channel name.
– Recipient List Router - the message goes to all
statically defined channels
Flow components (continued...)
• Splitters - splits a message into pieces
– Custom splitters - any bean method;
– Framework AbstractMessageSplitter - use of method Object splitMessage(Message
m);
– Using annotation - @Splitter ;
• Aggregator
– assemble multiple messages to create a single parent message
– Complex task - all messages of a set have to arrive before aggregators can start work
– CorrelationStrategy - defines the key for grouping of the messages, the default
grouping is based on CORRELATION_ID
– ReleaseStrategy - dictates at which point the group of messages should be sent or
released for aggregation. Default is SequenceSizeReleazeStrategy
– Message Store - aggregators hold messages until all of them arrived. Options are:
• in-memory
• external database
• Resequencer - fix order of the messages(work on SEQUENCE_NUMBER)
Transformers
• Built-in transformers
– String Transformers - invokes toString() method of the payload
– Map Transformers - transformes POJO to a name-value pair of
Map
– Serializing and Deserializing Transformers - converts payload
to byte array
– JSON Transformers - object-to-json converts POJO to readable
JSON format; json-to-object transformer needs additional
property “type”
– XML Transformers - requires Spring OXM (Object-to-XML);
org.springframework.oxm.Marshaller/Unmarshaller
Transformers(continued...)
• Built-in transformers
– XPath Transformers - decodes
XML using XPath expressions, ex.:
xpath-
expression=”/mytag/@prop”
• Custom Transformers - can be any
spring bean method
• Using @Transformer
Students Example
• Example application will demo usage
of Kafka and Spring Integration
• App is built with maven
• Ideal candidate for Microservice
• Idea: takes students from outside and
calculates their average score
Maven dependencies
Project Structure
• Package “api” – POJO models
• Package “config” – beans with
factory methods
• Package “service” – the
business logic
• Folder “resources” –
application.properties
Spring Integration DSL
Students Example
Service activator
Running the app and giving some
inputs
Check the logs
Conclusion
Why Kafka and Spring ?
• Easy for microservices
• Clean and testable code
• Widely adopted technologies
• Easy to be dockerized
Introduction to Kafka with Spring Integration

More Related Content

What's hot

Kafka Tutorial Advanced Kafka Consumers
Kafka Tutorial Advanced Kafka ConsumersKafka Tutorial Advanced Kafka Consumers
Kafka Tutorial Advanced Kafka Consumers
Jean-Paul Azar
 
Microservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka EcosystemMicroservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka Ecosystem
confluent
 
Spring integration을 통해_살펴본_메시징_세계
Spring integration을 통해_살펴본_메시징_세계Spring integration을 통해_살펴본_메시징_세계
Spring integration을 통해_살펴본_메시징_세계
Wangeun Lee
 
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid RahimianAPI Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
Vahid Rahimian
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
Jemin Patel
 
Fundamentals of Apache Kafka
Fundamentals of Apache KafkaFundamentals of Apache Kafka
Fundamentals of Apache Kafka
Chhavi Parasher
 
ksqlDB - Stream Processing simplified!
ksqlDB - Stream Processing simplified!ksqlDB - Stream Processing simplified!
ksqlDB - Stream Processing simplified!
Guido Schmutz
 
Kafka
KafkaKafka
Kafka
shrenikp
 
Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1
Toshiaki Maki
 
Spring integration
Spring integrationSpring integration
Spring integration
Dominik Strzyżewski
 
Kafka Connect & Streams - the ecosystem around Kafka
Kafka Connect & Streams - the ecosystem around KafkaKafka Connect & Streams - the ecosystem around Kafka
Kafka Connect & Streams - the ecosystem around Kafka
Guido Schmutz
 
Apache Kafka Introduction
Apache Kafka IntroductionApache Kafka Introduction
Apache Kafka Introduction
Amita Mirajkar
 
Flink vs. Spark
Flink vs. SparkFlink vs. Spark
Flink vs. Spark
Slim Baltagi
 
KSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for KafkaKSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for Kafka
confluent
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and Karma
Christopher Bartling
 
Design patterns for microservice architecture
Design patterns for microservice architectureDesign patterns for microservice architecture
Design patterns for microservice architecture
The Software House
 
Kafka presentation
Kafka presentationKafka presentation
Kafka presentation
Mohammed Fazuluddin
 
Spring Webflux
Spring WebfluxSpring Webflux
Spring Webflux
Carlos E. Salazar
 
From Zero to Hero with Kafka Connect
From Zero to Hero with Kafka ConnectFrom Zero to Hero with Kafka Connect
From Zero to Hero with Kafka Connect
confluent
 
Spring Framework - Data Access
Spring Framework - Data AccessSpring Framework - Data Access
Spring Framework - Data Access
Dzmitry Naskou
 

What's hot (20)

Kafka Tutorial Advanced Kafka Consumers
Kafka Tutorial Advanced Kafka ConsumersKafka Tutorial Advanced Kafka Consumers
Kafka Tutorial Advanced Kafka Consumers
 
Microservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka EcosystemMicroservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka Ecosystem
 
Spring integration을 통해_살펴본_메시징_세계
Spring integration을 통해_살펴본_메시징_세계Spring integration을 통해_살펴본_메시징_세계
Spring integration을 통해_살펴본_메시징_세계
 
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid RahimianAPI Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Fundamentals of Apache Kafka
Fundamentals of Apache KafkaFundamentals of Apache Kafka
Fundamentals of Apache Kafka
 
ksqlDB - Stream Processing simplified!
ksqlDB - Stream Processing simplified!ksqlDB - Stream Processing simplified!
ksqlDB - Stream Processing simplified!
 
Kafka
KafkaKafka
Kafka
 
Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1
 
Spring integration
Spring integrationSpring integration
Spring integration
 
Kafka Connect & Streams - the ecosystem around Kafka
Kafka Connect & Streams - the ecosystem around KafkaKafka Connect & Streams - the ecosystem around Kafka
Kafka Connect & Streams - the ecosystem around Kafka
 
Apache Kafka Introduction
Apache Kafka IntroductionApache Kafka Introduction
Apache Kafka Introduction
 
Flink vs. Spark
Flink vs. SparkFlink vs. Spark
Flink vs. Spark
 
KSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for KafkaKSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for Kafka
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and Karma
 
Design patterns for microservice architecture
Design patterns for microservice architectureDesign patterns for microservice architecture
Design patterns for microservice architecture
 
Kafka presentation
Kafka presentationKafka presentation
Kafka presentation
 
Spring Webflux
Spring WebfluxSpring Webflux
Spring Webflux
 
From Zero to Hero with Kafka Connect
From Zero to Hero with Kafka ConnectFrom Zero to Hero with Kafka Connect
From Zero to Hero with Kafka Connect
 
Spring Framework - Data Access
Spring Framework - Data AccessSpring Framework - Data Access
Spring Framework - Data Access
 

Viewers also liked

Microservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloudMicroservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloud
Ben Wilcock
 
Introduction To Functional Reactive Programming Poznan
Introduction To Functional Reactive Programming PoznanIntroduction To Functional Reactive Programming Poznan
Introduction To Functional Reactive Programming Poznan
Eliasz Sawicki
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modeling
Mario Fusco
 
Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...
Mario Fusco
 
Spring integration with the Java DSL
Spring integration with the Java DSLSpring integration with the Java DSL
Spring integration with the Java DSL
Ben Wilcock
 
Microservice Architecture with CQRS and Event Sourcing
Microservice Architecture with CQRS and Event SourcingMicroservice Architecture with CQRS and Event Sourcing
Microservice Architecture with CQRS and Event Sourcing
Ben Wilcock
 
Integration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesIntegration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices Architectures
Apcera
 
Scaling wix with microservices architecture devoxx London 2015
Scaling wix with microservices architecture devoxx London 2015Scaling wix with microservices architecture devoxx London 2015
Scaling wix with microservices architecture devoxx London 2015
Aviran Mordo
 

Viewers also liked (8)

Microservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloudMicroservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloud
 
Introduction To Functional Reactive Programming Poznan
Introduction To Functional Reactive Programming PoznanIntroduction To Functional Reactive Programming Poznan
Introduction To Functional Reactive Programming Poznan
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modeling
 
Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...
 
Spring integration with the Java DSL
Spring integration with the Java DSLSpring integration with the Java DSL
Spring integration with the Java DSL
 
Microservice Architecture with CQRS and Event Sourcing
Microservice Architecture with CQRS and Event SourcingMicroservice Architecture with CQRS and Event Sourcing
Microservice Architecture with CQRS and Event Sourcing
 
Integration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesIntegration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices Architectures
 
Scaling wix with microservices architecture devoxx London 2015
Scaling wix with microservices architecture devoxx London 2015Scaling wix with microservices architecture devoxx London 2015
Scaling wix with microservices architecture devoxx London 2015
 

Similar to Introduction to Kafka with Spring Integration

Spring integration
Spring integrationSpring integration
Spring integration
Oliver Gierke
 
Hadoop Ecosystem and Low Latency Streaming Architecture
Hadoop Ecosystem and Low Latency Streaming ArchitectureHadoop Ecosystem and Low Latency Streaming Architecture
Hadoop Ecosystem and Low Latency Streaming Architecture
InSemble
 
Real Time Machine Learning Visualization with Spark
Real Time Machine Learning Visualization with SparkReal Time Machine Learning Visualization with Spark
Real Time Machine Learning Visualization with Spark
DataWorks Summit/Hadoop Summit
 
Real time machine learning visualization with spark -- Hadoop Summit 2016
Real time machine learning visualization with spark -- Hadoop Summit 2016Real time machine learning visualization with spark -- Hadoop Summit 2016
Real time machine learning visualization with spark -- Hadoop Summit 2016
Chester Chen
 
AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
QCloudMentor
 
Mihalache catalin eip with spring integration
Mihalache catalin   eip with spring integrationMihalache catalin   eip with spring integration
Mihalache catalin eip with spring integration
Codecamp Romania
 
Event-driven architecture with Java technology stack
Event-driven architecture with Java technology stackEvent-driven architecture with Java technology stack
Event-driven architecture with Java technology stack
Anna Shymchenko
 
Sprintintegration ajip
Sprintintegration ajipSprintintegration ajip
Sprintintegration ajip
Makarand Bhatambarekar
 
Spring integration
Spring integrationSpring integration
Spring integration
Zülfikar Karakaya
 
Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQ
Zoran Majstorovic
 
Kafka tutorial
Kafka tutorialKafka tutorial
Kafka tutorial
Srikrishna k
 
Slides cao
Slides caoSlides cao
Slides cao
Aravindharamanan S
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
Srikrishna k
 
apachekafka-160907180205.pdf
apachekafka-160907180205.pdfapachekafka-160907180205.pdf
apachekafka-160907180205.pdf
TarekHamdi8
 
quickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationquickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integration
jorgesimao71
 
Messaging with Spring Integration
Messaging with Spring IntegrationMessaging with Spring Integration
Messaging with Spring Integration
Vadim Mikhnevych
 
Building an Event Bus at Scale
Building an Event Bus at ScaleBuilding an Event Bus at Scale
Building an Event Bus at Scale
jimriecken
 
ResourceSync: Web-based Resource Synchronization
ResourceSync: Web-based Resource SynchronizationResourceSync: Web-based Resource Synchronization
ResourceSync: Web-based Resource Synchronization
Simeon Warner
 
UNIT I DIS.pptx
UNIT I DIS.pptxUNIT I DIS.pptx
UNIT I DIS.pptx
SamPrem3
 
Kafka blr-meetup-presentation - Kafka internals
Kafka blr-meetup-presentation - Kafka internalsKafka blr-meetup-presentation - Kafka internals
Kafka blr-meetup-presentation - Kafka internals
Ayyappadas Ravindran (Appu)
 

Similar to Introduction to Kafka with Spring Integration (20)

Spring integration
Spring integrationSpring integration
Spring integration
 
Hadoop Ecosystem and Low Latency Streaming Architecture
Hadoop Ecosystem and Low Latency Streaming ArchitectureHadoop Ecosystem and Low Latency Streaming Architecture
Hadoop Ecosystem and Low Latency Streaming Architecture
 
Real Time Machine Learning Visualization with Spark
Real Time Machine Learning Visualization with SparkReal Time Machine Learning Visualization with Spark
Real Time Machine Learning Visualization with Spark
 
Real time machine learning visualization with spark -- Hadoop Summit 2016
Real time machine learning visualization with spark -- Hadoop Summit 2016Real time machine learning visualization with spark -- Hadoop Summit 2016
Real time machine learning visualization with spark -- Hadoop Summit 2016
 
AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
AWS Study Group - Chapter 07 - Integrating Application Services [Solution Arc...
 
Mihalache catalin eip with spring integration
Mihalache catalin   eip with spring integrationMihalache catalin   eip with spring integration
Mihalache catalin eip with spring integration
 
Event-driven architecture with Java technology stack
Event-driven architecture with Java technology stackEvent-driven architecture with Java technology stack
Event-driven architecture with Java technology stack
 
Sprintintegration ajip
Sprintintegration ajipSprintintegration ajip
Sprintintegration ajip
 
Spring integration
Spring integrationSpring integration
Spring integration
 
Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQ
 
Kafka tutorial
Kafka tutorialKafka tutorial
Kafka tutorial
 
Slides cao
Slides caoSlides cao
Slides cao
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
apachekafka-160907180205.pdf
apachekafka-160907180205.pdfapachekafka-160907180205.pdf
apachekafka-160907180205.pdf
 
quickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationquickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integration
 
Messaging with Spring Integration
Messaging with Spring IntegrationMessaging with Spring Integration
Messaging with Spring Integration
 
Building an Event Bus at Scale
Building an Event Bus at ScaleBuilding an Event Bus at Scale
Building an Event Bus at Scale
 
ResourceSync: Web-based Resource Synchronization
ResourceSync: Web-based Resource SynchronizationResourceSync: Web-based Resource Synchronization
ResourceSync: Web-based Resource Synchronization
 
UNIT I DIS.pptx
UNIT I DIS.pptxUNIT I DIS.pptx
UNIT I DIS.pptx
 
Kafka blr-meetup-presentation - Kafka internals
Kafka blr-meetup-presentation - Kafka internalsKafka blr-meetup-presentation - Kafka internals
Kafka blr-meetup-presentation - Kafka internals
 

Recently uploaded

Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
Karya Keeper
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
NishanthaBulumulla1
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 

Recently uploaded (20)

Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 

Introduction to Kafka with Spring Integration

  • 1. Introduction to Kafka with Spring Integration
  • 2. Introduction to Kafka with Spring Integration • Kafka (Mihail Yordanov) • Spring integration (Borislav Markov) • Students Example (Mihail & Borislav) • Conclusion
  • 3. Motivation • Real time data being continuously generated • Producers and consumers relationships • Streaming systems • Messaging systems
  • 4. Apache Kafka • Developed by LinkedIn • “We built Apache Kafka at LinkedIn with a specific purpose in mind: to serve as a central repository of data streams.” - Jay Kreps • Kafka improvements – Transporting data between systems – Richer analytical processing • “A publish-subscribe messaging system rethought as a distributed commit log”
  • 5. Kafka Vocabulary • Brokers • Producers • Consumers • “A publish-subscribe messaging system rethought as a distributed commit log”
  • 6. Kafka Vocabulary • Topics • Partitions • “A publish-subscribe messaging system rethought as a distributed commit log”
  • 10. Consumer groups • Definition - “A publish-subscribe messaging system rethought as a distributed commit log” • Publish - Subscribe • Queueing
  • 11. Spring Integration • Spring Integration enables lightweight messaging • Supports integration with external systems via declarative adapters • Primary goal is to provide a simple model for building enterprise integration solutions • Separation of concerns • Maintainable, testable code
  • 12. Features • Implementation of most of the Enterprise Integration Patterns • Endpoint • Channel (Point-to-point and Publish/Subscribe) • Aggregator • Filter • Transformer • Control Bus • … • Integration with External Systems • ReST/HTTP • ...
  • 13. The theory... The patterns can be found at http://www.enterpriseintegrationpatterns.com/patterns/messag ing/index.html
  • 14. Message • Messages are objects that carry information between two applications • They are constructed by the producer and they are consumed/deconstructed at the consumer/subscriber • Message consists of: – payload – header public interface Message<T> { T getPayload(); MessageHeaders getHeaders(); }
  • 15. Message endpoints Common endpoints: • Service Activator - invokes a method on a bean • Message Bridge - couples different messaging modes/adapters. Example: (P2P with Publish/Subscribe) • Message Enricher - enrich the incoming message with additional information. – Header Enricher - add header attributes – Payload Enricher - enrich payload
  • 16. Message endpoints (continued) • Gateway - Used when we don’t have knowledge for the messaging system. – Synchronous Gateway - void or returns T – Asynchronous Gateway - returns Future<T> • Delayer - introduce delay between sender and receiver • Consumers – Polling Consumers - poll messages in a timely fashion – Polling Using Triggers - poll messages with PeriodicTrigger and with CronTrigger – Event-Driven Consumers - they wait for someone to deliver the message (framework’s responsibility)
  • 17. Message endpoints (continued) • Channel Adapter - endpoint that connects a Message Channel to some other system or transport. –inbound –outbound
  • 18. Message Channels • interface MessageChannel – boolean send(Message<?> message); – boolean send(Message<?> message, long timeout); • Point-to-Point Mode -> PollableChannel – Message<?> receive(); – Message<?> receive(long timeout); • Publish/Subscribe Mode -> SubscribableChannel – boolean subscribe(MessageHandler handler); – boolean unsubscribe(MessageHandler handler);
  • 19. Message Channels(continued) •Queue Channel - has capacity •Priority Channel - queue channel with prioritization •PublishSubscribe Channel •DirectChannel - mixed type P2P and Pub/Sub
  • 21. Flow components • Filters – Custom filters are tied to the framework, can be bean method returning boolean – Framework MessageSelector - use of method boolean accept(Message m) – Using annotation - @Filter • Routers – PayloadTypeRouter – HeaderValueRouter – Custom Routers - any bean method can be router, the result will be the channel name. – Recipient List Router - the message goes to all statically defined channels
  • 22. Flow components (continued...) • Splitters - splits a message into pieces – Custom splitters - any bean method; – Framework AbstractMessageSplitter - use of method Object splitMessage(Message m); – Using annotation - @Splitter ; • Aggregator – assemble multiple messages to create a single parent message – Complex task - all messages of a set have to arrive before aggregators can start work – CorrelationStrategy - defines the key for grouping of the messages, the default grouping is based on CORRELATION_ID – ReleaseStrategy - dictates at which point the group of messages should be sent or released for aggregation. Default is SequenceSizeReleazeStrategy – Message Store - aggregators hold messages until all of them arrived. Options are: • in-memory • external database • Resequencer - fix order of the messages(work on SEQUENCE_NUMBER)
  • 23. Transformers • Built-in transformers – String Transformers - invokes toString() method of the payload – Map Transformers - transformes POJO to a name-value pair of Map – Serializing and Deserializing Transformers - converts payload to byte array – JSON Transformers - object-to-json converts POJO to readable JSON format; json-to-object transformer needs additional property “type” – XML Transformers - requires Spring OXM (Object-to-XML); org.springframework.oxm.Marshaller/Unmarshaller
  • 24. Transformers(continued...) • Built-in transformers – XPath Transformers - decodes XML using XPath expressions, ex.: xpath- expression=”/mytag/@prop” • Custom Transformers - can be any spring bean method • Using @Transformer
  • 25. Students Example • Example application will demo usage of Kafka and Spring Integration • App is built with maven • Ideal candidate for Microservice • Idea: takes students from outside and calculates their average score
  • 27. Project Structure • Package “api” – POJO models • Package “config” – beans with factory methods • Package “service” – the business logic • Folder “resources” – application.properties
  • 31.
  • 32. Running the app and giving some inputs
  • 34. Conclusion Why Kafka and Spring ? • Easy for microservices • Clean and testable code • Widely adopted technologies • Easy to be dockerized