SlideShare une entreprise Scribd logo
1  sur  47
2016
HOW TO COOK APACHE KAFKA
WITH CAMEL AND SPRING BOOT
2Java EE conference 2016
Ivan Vasyliev
Playtika Core Services Team
AGENDA
Basics of Apache Kafka
Apache Camel
Spring Boot
Demo
Q&A
3Java EE conference 2016
CODE SLIDES
WHY APACHE KAFKA?
4Java EE conference 2016
http://research.microsoft.com/en-us/um/people/srikanth/netdb11/netdb11papers/netdb11-final12.pdf
WHY APACHE KAFKA?
Designed for large scale
Widely adopted by top tech companies
Hardened production quality product
Data replication out of the box
5Java EE conference 2016
FEATURES
At most once, at least once guarantees
Batching for high throughput cases
Efficient with DEFAULT settings
6Java EE conference 2016
EVEN MORE FEATURES
Mirroring between datacenters
Connectors to various DWH
Complex event processing integrations
7Java EE conference 2016
HIGH LEVEL VIEW
8Java EE conference 2016
http://kafka.apache.org/documentation.html#introduction
HIGH LEVEL VIEW
Publisher/subscriber and point-to-point models
Client which sends message – producer
Client which receives messages - consumer
9Java EE conference 2016
WHAT IS NOT INCLUDED - JMS
10Java EE conference 2016
WHAT IS NOT INCLUDED - JMS
Not a JMS compliant server
No message headers
Can employ message key
Send in payload
Wait for it, on roadmap
No transactions/JTA support
11Java EE conference 2016
WHAT IS NOT INCLUDED - EXACTLY ONCE GUARANTEE
12Java EE conference 2016
WHAT IS NOT INCLUDED - EXACTLY ONCE GUARANTEE
No exactly once guarantee
Duplicates because of failures
De-duplication is on roadmap
De-duplication on consumer
With camel EIP, by message ID/body
Consumer can tolerate duplicates
13Java EE conference 2016
APACHE KAFKA LANGUAGE
14Java EE conference 2016
http://research.microsoft.com/en-us/um/people/srikanth/netdb11/netdb11papers/netdb11-final12.pdf
APACHE KAFKA LANGUAGE
Topic - represents stream of messages
Contains set of partitions
Partition - subset of messages in stream
Partitioning is done by message key on producer
No “queue” in dictionary
15Java EE conference 2016
TOPICS AND PARTITIONS
16Java EE conference 2016
http://kafka.apache.org/documentation.html#intro_topics
TOPICS AND PARTITIONS
Partition is smallest unit of storage in kafka
Partition is data file with messages
Producer always append to end of file
Consumers scroll/seek over file
Consumer offset is persisted (zk or kafka)
Strong ordering guarantees for consumer
17Java EE conference 2016
QUEUE SEMANTIC IS DONE ON CLIENT
18Java EE conference 2016
http://kafka.apache.org/documentation.html#intro_consumers
QUEUE
Consumer offset is persisted by group id/per partition
Queue semantic inside of consumer group
Topic semantic between consumer groups
19Java EE conference 2016
CONSUMPTION IS ALL ABOUT OFFSETS
20Java EE conference 2016
https://hadoopabcd.wordpress.com/2015/04/11/kafka-building-a-real-time-data-pipeline/
CONSUMPTION IS ALL ABOUT OFFSETS
Consumer polls data from broker
Consumer offset is send (committed) to server
Auto offset commit enabled
By separate thread, periodically
Auto offset commit disabled
By your code, when batch of messages processed
21Java EE conference 2016
CONSUMER OFFSET AND AUTO-COMMIT
22Java EE conference 2016
CONSUMER OFFSET AND AUTO-COMMIT
With “auto-commit” enabled you can loose messages
Step1: One thread did not finish processing and failed
Step 2: Auto-commit thread does not care
Auto-commit is OK for status heartbeats
Auto-commit is NOT OK if you need “at least once”
guarantee, e.g. payment processing
23Java EE conference 2016
DATA REPLICATION
24Java EE conference 2016
DATA REPLICATION
Leader receives all reads and writes
Decides when to commit message
Follower syncs messages from leader
Take over if leader is down
Replication controller maintains leader
Zookeper used for coordination
Leader election
Consensus protocol
25Java EE conference 2016
APACHE KAFKA PRODUCER
26Java EE conference 2016
APACHE KAFKA PRODUCER
Performs load balancing
Uses message key to select partition
Finds appropriate kafka broker leader for partition
Has few configurable acknowledge modes
Can do batching in async mode
27Java EE conference 2016
DELIVERY GUARANTEED
28Java EE conference 2016
DELIVERY GUARANTEED
Durability with ack levels on producer side
Data replication between brokers
No in-memory state, efficient persistence
Manually committing offset on consumer side
29Java EE conference 2016
ISSUES - OPS
Ops is not free
There is Zookeeper on board
Easy to setup with Docker/Rancher
Need to learn basics to setup and monitor
30Java EE conference 2016
ISSUES – DATA
Can’t auto-scale existing data
Option 1: Add new partitions, they will go to new nodes
Option 2: Do it manually, move partitions around
Option 3: Wait for it, on roadmap
Mirroring seems to work into one direction
Can’t handle very large number of topics
31Java EE conference 2016
WHY APACHE CAMEL?
32Java EE conference 2016
WHY APACHE CAMEL?
Message routing DSL (java/scala/grooovy)
Enterprise Integration Patterns
Idempotent consumer (de-duplication)
Aggregator
…
Abstractions for testing
MockEndpoint
Route Advice
33Java EE conference 2016
APACHE CAMEL
34Java EE conference 2016
http://camel.apache.org/java-dsl.html
APACHE CAMEL
Lightweight and embeddable
Spring boot integration
Connectors to various message and data sources
35Java EE conference 2016
SPRING BOOT
36Java EE conference 2016
SPRING BOOT
Fat jar/jee containerless deployment
Autoconfiguration and conditionals
Сodeless usage of spring cloud/netflix projects
37Java EE conference 2016
38Java EE conference 2016
GOTCHA’S – PRODUCER FASTER THAN CONSUMER, PRECONDITIONS
Its not recommended to have lots of partitions
Each partition is consumed by one consumer thread
Producer X times faster than consumer
39Java EE conference 2016
GOTCHA’S – PRODUCER FASTER THAN CONSUMERS, ACTIONS
Monitor kafka lag
Messages not consumed by group
Add intermediate multiplexing queue
See camel “seda” component
Think carefully since in-memory state can lead to data loss
Consider adding more partitions
Will allow more consumption threads
40Java EE conference 2016
GOTCHA’S – PRODUCER FASTER THAN CONSUMERS, TOOLS
41Java EE conference 2016
https://github.com/quantifind/KafkaOffsetMonitor
GOTCHA’S – AUTO OFFSET RESET
When you start test you do not receive any messages
Producer sends message before consumer is UP
Check auto.offset.reset setting in unit test
Latest (or largest in old api) can lead to consumption of only new messages
Earliest (or smallest in old api) will mean “from beginning”
42Java EE conference 2016
GOTCHA’S – CLIENT VERSION MIGHT NEED TO MATCH SERVER
Clients supposed to be “backward compatible”, but …
If you see weird things – you should check classpath
43Java EE conference 2016
GOTCHA’S – WATCH THE CLASSPATH
Multiple versions of kafka client
Multiple versions of kafka client dependencies
Multiple versions of zookeper client
44Java EE conference 2016
DEPENDENCY MANAGEMENT
Use dependency management to force versions and
exclusions
Use “Maven helper” Intellij plugin to check issues
https://github.com/krasa/MavenHelper
https://plugins.jetbrains.com/plugin/7179
45Java EE conference 2016
46Java EE conference 2016
Thank you!
ivasylyev@playtika.com
Join us:
http://goo.gl/LuWMo3
47Java EE conference 2016

Contenu connexe

Tendances

Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...confluent
 
Kafka Summit SF 2017 - Kafka Connect Best Practices – Advice from the Field
Kafka Summit SF 2017 - Kafka Connect Best Practices – Advice from the FieldKafka Summit SF 2017 - Kafka Connect Best Practices – Advice from the Field
Kafka Summit SF 2017 - Kafka Connect Best Practices – Advice from the Fieldconfluent
 
Let the alpakka pull your stream
Let the alpakka pull your streamLet the alpakka pull your stream
Let the alpakka pull your streamEnno Runne
 
Kafka Tutorial: Streaming Data Architecture
Kafka Tutorial: Streaming Data ArchitectureKafka Tutorial: Streaming Data Architecture
Kafka Tutorial: Streaming Data ArchitectureJean-Paul Azar
 
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 KafkaGuido Schmutz
 
Data Pipelines with Kafka Connect
Data Pipelines with Kafka ConnectData Pipelines with Kafka Connect
Data Pipelines with Kafka ConnectKaufman Ng
 
A la rencontre de Kafka, le log distribué par Florian GARCIA
A la rencontre de Kafka, le log distribué par Florian GARCIAA la rencontre de Kafka, le log distribué par Florian GARCIA
A la rencontre de Kafka, le log distribué par Florian GARCIALa Cuisine du Web
 
Introduction to Apache Kafka- Part 1
Introduction to Apache Kafka- Part 1Introduction to Apache Kafka- Part 1
Introduction to Apache Kafka- Part 1Knoldus Inc.
 
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...Erik Onnen
 
Introducing Exactly Once Semantics To Apache Kafka
Introducing Exactly Once Semantics To Apache KafkaIntroducing Exactly Once Semantics To Apache Kafka
Introducing Exactly Once Semantics To Apache KafkaApurva Mehta
 
Introduction to Apache Kafka and why it matters - Madrid
Introduction to Apache Kafka and why it matters - MadridIntroduction to Apache Kafka and why it matters - Madrid
Introduction to Apache Kafka and why it matters - MadridPaolo Castagna
 
What's new in Confluent 3.2 and Apache Kafka 0.10.2
What's new in Confluent 3.2 and Apache Kafka 0.10.2 What's new in Confluent 3.2 and Apache Kafka 0.10.2
What's new in Confluent 3.2 and Apache Kafka 0.10.2 confluent
 
Introduction Apache Kafka
Introduction Apache KafkaIntroduction Apache Kafka
Introduction Apache KafkaJoe Stein
 
From Newbie to Highly Available, a Successful Kafka Adoption Tale (Jonathan S...
From Newbie to Highly Available, a Successful Kafka Adoption Tale (Jonathan S...From Newbie to Highly Available, a Successful Kafka Adoption Tale (Jonathan S...
From Newbie to Highly Available, a Successful Kafka Adoption Tale (Jonathan S...confluent
 
The best of Apache Kafka Architecture
The best of Apache Kafka ArchitectureThe best of Apache Kafka Architecture
The best of Apache Kafka Architecturetechmaddy
 
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10 an integration story
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10  an integration story[Spark Summit EU 2017] Apache spark streaming + kafka 0.10  an integration story
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10 an integration storyJoan Viladrosa Riera
 
Exactly-once Semantics in Apache Kafka
Exactly-once Semantics in Apache KafkaExactly-once Semantics in Apache Kafka
Exactly-once Semantics in Apache Kafkaconfluent
 
Building High-Throughput, Low-Latency Pipelines in Kafka
Building High-Throughput, Low-Latency Pipelines in KafkaBuilding High-Throughput, Low-Latency Pipelines in Kafka
Building High-Throughput, Low-Latency Pipelines in Kafkaconfluent
 

Tendances (20)

Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
 
Kafka Summit SF 2017 - Kafka Connect Best Practices – Advice from the Field
Kafka Summit SF 2017 - Kafka Connect Best Practices – Advice from the FieldKafka Summit SF 2017 - Kafka Connect Best Practices – Advice from the Field
Kafka Summit SF 2017 - Kafka Connect Best Practices – Advice from the Field
 
Let the alpakka pull your stream
Let the alpakka pull your streamLet the alpakka pull your stream
Let the alpakka pull your stream
 
Kafka Tutorial: Streaming Data Architecture
Kafka Tutorial: Streaming Data ArchitectureKafka Tutorial: Streaming Data Architecture
Kafka Tutorial: Streaming Data Architecture
 
Introduction to apache kafka
Introduction to apache kafkaIntroduction to apache kafka
Introduction to apache kafka
 
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
 
Data Pipelines with Kafka Connect
Data Pipelines with Kafka ConnectData Pipelines with Kafka Connect
Data Pipelines with Kafka Connect
 
A la rencontre de Kafka, le log distribué par Florian GARCIA
A la rencontre de Kafka, le log distribué par Florian GARCIAA la rencontre de Kafka, le log distribué par Florian GARCIA
A la rencontre de Kafka, le log distribué par Florian GARCIA
 
Introduction to Apache Kafka- Part 1
Introduction to Apache Kafka- Part 1Introduction to Apache Kafka- Part 1
Introduction to Apache Kafka- Part 1
 
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
 
Introducing Exactly Once Semantics To Apache Kafka
Introducing Exactly Once Semantics To Apache KafkaIntroducing Exactly Once Semantics To Apache Kafka
Introducing Exactly Once Semantics To Apache Kafka
 
Introduction to Apache Kafka and why it matters - Madrid
Introduction to Apache Kafka and why it matters - MadridIntroduction to Apache Kafka and why it matters - Madrid
Introduction to Apache Kafka and why it matters - Madrid
 
What's new in Confluent 3.2 and Apache Kafka 0.10.2
What's new in Confluent 3.2 and Apache Kafka 0.10.2 What's new in Confluent 3.2 and Apache Kafka 0.10.2
What's new in Confluent 3.2 and Apache Kafka 0.10.2
 
Introduction Apache Kafka
Introduction Apache KafkaIntroduction Apache Kafka
Introduction Apache Kafka
 
From Newbie to Highly Available, a Successful Kafka Adoption Tale (Jonathan S...
From Newbie to Highly Available, a Successful Kafka Adoption Tale (Jonathan S...From Newbie to Highly Available, a Successful Kafka Adoption Tale (Jonathan S...
From Newbie to Highly Available, a Successful Kafka Adoption Tale (Jonathan S...
 
The best of Apache Kafka Architecture
The best of Apache Kafka ArchitectureThe best of Apache Kafka Architecture
The best of Apache Kafka Architecture
 
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10 an integration story
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10  an integration story[Spark Summit EU 2017] Apache spark streaming + kafka 0.10  an integration story
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10 an integration story
 
Exactly-once Semantics in Apache Kafka
Exactly-once Semantics in Apache KafkaExactly-once Semantics in Apache Kafka
Exactly-once Semantics in Apache Kafka
 
Building High-Throughput, Low-Latency Pipelines in Kafka
Building High-Throughput, Low-Latency Pipelines in KafkaBuilding High-Throughput, Low-Latency Pipelines in Kafka
Building High-Throughput, Low-Latency Pipelines in Kafka
 
kafka for db as postgres
kafka for db as postgreskafka for db as postgres
kafka for db as postgres
 

En vedette

JEEConf 2016. Effectiveness and code optimization in Java applications
JEEConf 2016. Effectiveness and code optimization in  Java applicationsJEEConf 2016. Effectiveness and code optimization in  Java applications
JEEConf 2016. Effectiveness and code optimization in Java applicationsStrannik_2013
 
Developing real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and KafkaDeveloping real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and Kafkamarius_bogoevici
 
Leverage Enterprise Integration Patterns with Apache Camel and Twitter
Leverage Enterprise Integration Patterns with Apache Camel and TwitterLeverage Enterprise Integration Patterns with Apache Camel and Twitter
Leverage Enterprise Integration Patterns with Apache Camel and TwitterBruno Borges
 
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»Viktor Gamov
 
Functional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIAFunctional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIAViktor Gamov
 
Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray Baruch Sadogursky
 
WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java DevelopersWebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java DevelopersViktor Gamov
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...Baruch Sadogursky
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]Baruch Sadogursky
 
Spring Data: New approach to persistence
Spring Data: New approach to persistenceSpring Data: New approach to persistence
Spring Data: New approach to persistenceOleksiy Rezchykov
 
Testing Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupTesting Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupViktor Gamov
 
Morning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversaryMorning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversaryTaras Matyashovsky
 
Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
Couchbase Sydney meetup #1    Couchbase Architecture and ScalabilityCouchbase Sydney meetup #1    Couchbase Architecture and Scalability
Couchbase Sydney meetup #1 Couchbase Architecture and ScalabilityKarthik Babu Sekar
 
Springboot and camel
Springboot and camelSpringboot and camel
Springboot and camelDeepak Kumar
 
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017Baruch Sadogursky
 
How Immutability Helps in OOP
How Immutability Helps in OOPHow Immutability Helps in OOP
How Immutability Helps in OOPYegor Bugayenko
 
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...Baruch Sadogursky
 
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Baruch Sadogursky
 

En vedette (20)

JEEConf 2016. Effectiveness and code optimization in Java applications
JEEConf 2016. Effectiveness and code optimization in  Java applicationsJEEConf 2016. Effectiveness and code optimization in  Java applications
JEEConf 2016. Effectiveness and code optimization in Java applications
 
Developing real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and KafkaDeveloping real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and Kafka
 
Leverage Enterprise Integration Patterns with Apache Camel and Twitter
Leverage Enterprise Integration Patterns with Apache Camel and TwitterLeverage Enterprise Integration Patterns with Apache Camel and Twitter
Leverage Enterprise Integration Patterns with Apache Camel and Twitter
 
Java 8 puzzlers
Java 8 puzzlersJava 8 puzzlers
Java 8 puzzlers
 
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
 
Functional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIAFunctional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIA
 
Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray
 
WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java DevelopersWebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]
 
Spring Data: New approach to persistence
Spring Data: New approach to persistenceSpring Data: New approach to persistence
Spring Data: New approach to persistence
 
Testing Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupTesting Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user group
 
Confession of an Engineer
Confession of an EngineerConfession of an Engineer
Confession of an Engineer
 
Morning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversaryMorning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversary
 
Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
Couchbase Sydney meetup #1    Couchbase Architecture and ScalabilityCouchbase Sydney meetup #1    Couchbase Architecture and Scalability
Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
 
Springboot and camel
Springboot and camelSpringboot and camel
Springboot and camel
 
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
 
How Immutability Helps in OOP
How Immutability Helps in OOPHow Immutability Helps in OOP
How Immutability Helps in OOP
 
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
 
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
 

Similaire à Javaeeconf 2016 how to cook apache kafka with camel and spring boot

How Apache Kafka is transforming Hadoop, Spark and Storm
How Apache Kafka is transforming Hadoop, Spark and StormHow Apache Kafka is transforming Hadoop, Spark and Storm
How Apache Kafka is transforming Hadoop, Spark and StormEdureka!
 
Building Event-Driven Systems with Apache Kafka
Building Event-Driven Systems with Apache KafkaBuilding Event-Driven Systems with Apache Kafka
Building Event-Driven Systems with Apache KafkaBrian Ritchie
 
How kafka is transforming hadoop, spark & storm
How kafka is transforming hadoop, spark & stormHow kafka is transforming hadoop, spark & storm
How kafka is transforming hadoop, spark & stormEdureka!
 
[Big Data Spain] Apache Spark Streaming + Kafka 0.10: an Integration Story
[Big Data Spain] Apache Spark Streaming + Kafka 0.10:  an Integration Story[Big Data Spain] Apache Spark Streaming + Kafka 0.10:  an Integration Story
[Big Data Spain] Apache Spark Streaming + Kafka 0.10: an Integration StoryJoan Viladrosa Riera
 
Apache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
Apache Spark Streaming + Kafka 0.10 with Joan ViladrosarieraApache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
Apache Spark Streaming + Kafka 0.10 with Joan ViladrosarieraSpark Summit
 
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...Athens Big Data
 
Connect K of SMACK:pykafka, kafka-python or?
Connect K of SMACK:pykafka, kafka-python or?Connect K of SMACK:pykafka, kafka-python or?
Connect K of SMACK:pykafka, kafka-python or?Micron Technology
 
Apache Kafka: Next Generation Distributed Messaging System
Apache Kafka: Next Generation Distributed Messaging SystemApache Kafka: Next Generation Distributed Messaging System
Apache Kafka: Next Generation Distributed Messaging SystemEdureka!
 
Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
 Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S... Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...HostedbyConfluent
 
Spark Streaming + Kafka 0.10: an integration story by Joan Viladrosa Riera at...
Spark Streaming + Kafka 0.10: an integration story by Joan Viladrosa Riera at...Spark Streaming + Kafka 0.10: an integration story by Joan Viladrosa Riera at...
Spark Streaming + Kafka 0.10: an integration story by Joan Viladrosa Riera at...Big Data Spain
 
101 ways to configure kafka - badly
101 ways to configure kafka - badly101 ways to configure kafka - badly
101 ways to configure kafka - badlyHenning Spjelkavik
 
Real time Messages at Scale with Apache Kafka and Couchbase
Real time Messages at Scale with Apache Kafka and CouchbaseReal time Messages at Scale with Apache Kafka and Couchbase
Real time Messages at Scale with Apache Kafka and CouchbaseWill Gardella
 
Learnings From Shipping 1000+ Streaming Data Pipelines To Production with Hak...
Learnings From Shipping 1000+ Streaming Data Pipelines To Production with Hak...Learnings From Shipping 1000+ Streaming Data Pipelines To Production with Hak...
Learnings From Shipping 1000+ Streaming Data Pipelines To Production with Hak...HostedbyConfluent
 
Apache Kafka with Spark Streaming: Real-time Analytics Redefined
Apache Kafka with Spark Streaming: Real-time Analytics RedefinedApache Kafka with Spark Streaming: Real-time Analytics Redefined
Apache Kafka with Spark Streaming: Real-time Analytics RedefinedEdureka!
 
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 Kafkaconfluent
 
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LMESet your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LMEconfluent
 
Introduction to the OpenPOWER Foundation - Open Source Days event
Introduction to the OpenPOWER Foundation - Open Source Days eventIntroduction to the OpenPOWER Foundation - Open Source Days event
Introduction to the OpenPOWER Foundation - Open Source Days eventMandie Quartly
 

Similaire à Javaeeconf 2016 how to cook apache kafka with camel and spring boot (20)

How Apache Kafka is transforming Hadoop, Spark and Storm
How Apache Kafka is transforming Hadoop, Spark and StormHow Apache Kafka is transforming Hadoop, Spark and Storm
How Apache Kafka is transforming Hadoop, Spark and Storm
 
Building Event-Driven Systems with Apache Kafka
Building Event-Driven Systems with Apache KafkaBuilding Event-Driven Systems with Apache Kafka
Building Event-Driven Systems with Apache Kafka
 
How kafka is transforming hadoop, spark & storm
How kafka is transforming hadoop, spark & stormHow kafka is transforming hadoop, spark & storm
How kafka is transforming hadoop, spark & storm
 
[Big Data Spain] Apache Spark Streaming + Kafka 0.10: an Integration Story
[Big Data Spain] Apache Spark Streaming + Kafka 0.10:  an Integration Story[Big Data Spain] Apache Spark Streaming + Kafka 0.10:  an Integration Story
[Big Data Spain] Apache Spark Streaming + Kafka 0.10: an Integration Story
 
Apache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
Apache Spark Streaming + Kafka 0.10 with Joan ViladrosarieraApache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
Apache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
 
Apache Kafka - Strakin Technologies Pvt Ltd
Apache Kafka - Strakin Technologies Pvt LtdApache Kafka - Strakin Technologies Pvt Ltd
Apache Kafka - Strakin Technologies Pvt Ltd
 
Kafka overview
Kafka overviewKafka overview
Kafka overview
 
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
 
Connect K of SMACK:pykafka, kafka-python or?
Connect K of SMACK:pykafka, kafka-python or?Connect K of SMACK:pykafka, kafka-python or?
Connect K of SMACK:pykafka, kafka-python or?
 
Apache Kafka: Next Generation Distributed Messaging System
Apache Kafka: Next Generation Distributed Messaging SystemApache Kafka: Next Generation Distributed Messaging System
Apache Kafka: Next Generation Distributed Messaging System
 
Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
 Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S... Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
 
Spark Streaming + Kafka 0.10: an integration story by Joan Viladrosa Riera at...
Spark Streaming + Kafka 0.10: an integration story by Joan Viladrosa Riera at...Spark Streaming + Kafka 0.10: an integration story by Joan Viladrosa Riera at...
Spark Streaming + Kafka 0.10: an integration story by Joan Viladrosa Riera at...
 
101 ways to configure kafka - badly
101 ways to configure kafka - badly101 ways to configure kafka - badly
101 ways to configure kafka - badly
 
Real time Messages at Scale with Apache Kafka and Couchbase
Real time Messages at Scale with Apache Kafka and CouchbaseReal time Messages at Scale with Apache Kafka and Couchbase
Real time Messages at Scale with Apache Kafka and Couchbase
 
Learnings From Shipping 1000+ Streaming Data Pipelines To Production with Hak...
Learnings From Shipping 1000+ Streaming Data Pipelines To Production with Hak...Learnings From Shipping 1000+ Streaming Data Pipelines To Production with Hak...
Learnings From Shipping 1000+ Streaming Data Pipelines To Production with Hak...
 
Apache Kafka with Spark Streaming: Real-time Analytics Redefined
Apache Kafka with Spark Streaming: Real-time Analytics RedefinedApache Kafka with Spark Streaming: Real-time Analytics Redefined
Apache Kafka with Spark Streaming: Real-time Analytics Redefined
 
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
 
Airavata_Architecture_xsede16
Airavata_Architecture_xsede16Airavata_Architecture_xsede16
Airavata_Architecture_xsede16
 
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LMESet your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
 
Introduction to the OpenPOWER Foundation - Open Source Days event
Introduction to the OpenPOWER Foundation - Open Source Days eventIntroduction to the OpenPOWER Foundation - Open Source Days event
Introduction to the OpenPOWER Foundation - Open Source Days event
 

Dernier

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 

Dernier (20)

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 

Javaeeconf 2016 how to cook apache kafka with camel and spring boot

  • 2. HOW TO COOK APACHE KAFKA WITH CAMEL AND SPRING BOOT 2Java EE conference 2016 Ivan Vasyliev Playtika Core Services Team
  • 3. AGENDA Basics of Apache Kafka Apache Camel Spring Boot Demo Q&A 3Java EE conference 2016 CODE SLIDES
  • 4. WHY APACHE KAFKA? 4Java EE conference 2016 http://research.microsoft.com/en-us/um/people/srikanth/netdb11/netdb11papers/netdb11-final12.pdf
  • 5. WHY APACHE KAFKA? Designed for large scale Widely adopted by top tech companies Hardened production quality product Data replication out of the box 5Java EE conference 2016
  • 6. FEATURES At most once, at least once guarantees Batching for high throughput cases Efficient with DEFAULT settings 6Java EE conference 2016
  • 7. EVEN MORE FEATURES Mirroring between datacenters Connectors to various DWH Complex event processing integrations 7Java EE conference 2016
  • 8. HIGH LEVEL VIEW 8Java EE conference 2016 http://kafka.apache.org/documentation.html#introduction
  • 9. HIGH LEVEL VIEW Publisher/subscriber and point-to-point models Client which sends message – producer Client which receives messages - consumer 9Java EE conference 2016
  • 10. WHAT IS NOT INCLUDED - JMS 10Java EE conference 2016
  • 11. WHAT IS NOT INCLUDED - JMS Not a JMS compliant server No message headers Can employ message key Send in payload Wait for it, on roadmap No transactions/JTA support 11Java EE conference 2016
  • 12. WHAT IS NOT INCLUDED - EXACTLY ONCE GUARANTEE 12Java EE conference 2016
  • 13. WHAT IS NOT INCLUDED - EXACTLY ONCE GUARANTEE No exactly once guarantee Duplicates because of failures De-duplication is on roadmap De-duplication on consumer With camel EIP, by message ID/body Consumer can tolerate duplicates 13Java EE conference 2016
  • 14. APACHE KAFKA LANGUAGE 14Java EE conference 2016 http://research.microsoft.com/en-us/um/people/srikanth/netdb11/netdb11papers/netdb11-final12.pdf
  • 15. APACHE KAFKA LANGUAGE Topic - represents stream of messages Contains set of partitions Partition - subset of messages in stream Partitioning is done by message key on producer No “queue” in dictionary 15Java EE conference 2016
  • 16. TOPICS AND PARTITIONS 16Java EE conference 2016 http://kafka.apache.org/documentation.html#intro_topics
  • 17. TOPICS AND PARTITIONS Partition is smallest unit of storage in kafka Partition is data file with messages Producer always append to end of file Consumers scroll/seek over file Consumer offset is persisted (zk or kafka) Strong ordering guarantees for consumer 17Java EE conference 2016
  • 18. QUEUE SEMANTIC IS DONE ON CLIENT 18Java EE conference 2016 http://kafka.apache.org/documentation.html#intro_consumers
  • 19. QUEUE Consumer offset is persisted by group id/per partition Queue semantic inside of consumer group Topic semantic between consumer groups 19Java EE conference 2016
  • 20. CONSUMPTION IS ALL ABOUT OFFSETS 20Java EE conference 2016 https://hadoopabcd.wordpress.com/2015/04/11/kafka-building-a-real-time-data-pipeline/
  • 21. CONSUMPTION IS ALL ABOUT OFFSETS Consumer polls data from broker Consumer offset is send (committed) to server Auto offset commit enabled By separate thread, periodically Auto offset commit disabled By your code, when batch of messages processed 21Java EE conference 2016
  • 22. CONSUMER OFFSET AND AUTO-COMMIT 22Java EE conference 2016
  • 23. CONSUMER OFFSET AND AUTO-COMMIT With “auto-commit” enabled you can loose messages Step1: One thread did not finish processing and failed Step 2: Auto-commit thread does not care Auto-commit is OK for status heartbeats Auto-commit is NOT OK if you need “at least once” guarantee, e.g. payment processing 23Java EE conference 2016
  • 24. DATA REPLICATION 24Java EE conference 2016
  • 25. DATA REPLICATION Leader receives all reads and writes Decides when to commit message Follower syncs messages from leader Take over if leader is down Replication controller maintains leader Zookeper used for coordination Leader election Consensus protocol 25Java EE conference 2016
  • 26. APACHE KAFKA PRODUCER 26Java EE conference 2016
  • 27. APACHE KAFKA PRODUCER Performs load balancing Uses message key to select partition Finds appropriate kafka broker leader for partition Has few configurable acknowledge modes Can do batching in async mode 27Java EE conference 2016
  • 28. DELIVERY GUARANTEED 28Java EE conference 2016
  • 29. DELIVERY GUARANTEED Durability with ack levels on producer side Data replication between brokers No in-memory state, efficient persistence Manually committing offset on consumer side 29Java EE conference 2016
  • 30. ISSUES - OPS Ops is not free There is Zookeeper on board Easy to setup with Docker/Rancher Need to learn basics to setup and monitor 30Java EE conference 2016
  • 31. ISSUES – DATA Can’t auto-scale existing data Option 1: Add new partitions, they will go to new nodes Option 2: Do it manually, move partitions around Option 3: Wait for it, on roadmap Mirroring seems to work into one direction Can’t handle very large number of topics 31Java EE conference 2016
  • 32. WHY APACHE CAMEL? 32Java EE conference 2016
  • 33. WHY APACHE CAMEL? Message routing DSL (java/scala/grooovy) Enterprise Integration Patterns Idempotent consumer (de-duplication) Aggregator … Abstractions for testing MockEndpoint Route Advice 33Java EE conference 2016
  • 34. APACHE CAMEL 34Java EE conference 2016 http://camel.apache.org/java-dsl.html
  • 35. APACHE CAMEL Lightweight and embeddable Spring boot integration Connectors to various message and data sources 35Java EE conference 2016
  • 36. SPRING BOOT 36Java EE conference 2016
  • 37. SPRING BOOT Fat jar/jee containerless deployment Autoconfiguration and conditionals Сodeless usage of spring cloud/netflix projects 37Java EE conference 2016
  • 39. GOTCHA’S – PRODUCER FASTER THAN CONSUMER, PRECONDITIONS Its not recommended to have lots of partitions Each partition is consumed by one consumer thread Producer X times faster than consumer 39Java EE conference 2016
  • 40. GOTCHA’S – PRODUCER FASTER THAN CONSUMERS, ACTIONS Monitor kafka lag Messages not consumed by group Add intermediate multiplexing queue See camel “seda” component Think carefully since in-memory state can lead to data loss Consider adding more partitions Will allow more consumption threads 40Java EE conference 2016
  • 41. GOTCHA’S – PRODUCER FASTER THAN CONSUMERS, TOOLS 41Java EE conference 2016 https://github.com/quantifind/KafkaOffsetMonitor
  • 42. GOTCHA’S – AUTO OFFSET RESET When you start test you do not receive any messages Producer sends message before consumer is UP Check auto.offset.reset setting in unit test Latest (or largest in old api) can lead to consumption of only new messages Earliest (or smallest in old api) will mean “from beginning” 42Java EE conference 2016
  • 43. GOTCHA’S – CLIENT VERSION MIGHT NEED TO MATCH SERVER Clients supposed to be “backward compatible”, but … If you see weird things – you should check classpath 43Java EE conference 2016
  • 44. GOTCHA’S – WATCH THE CLASSPATH Multiple versions of kafka client Multiple versions of kafka client dependencies Multiple versions of zookeper client 44Java EE conference 2016
  • 45. DEPENDENCY MANAGEMENT Use dependency management to force versions and exclusions Use “Maven helper” Intellij plugin to check issues https://github.com/krasa/MavenHelper https://plugins.jetbrains.com/plugin/7179 45Java EE conference 2016

Notes de l'éditeur

  1. Я Иван Васильев сейчас работаю в компании плейтика Занимаюсь разработкой высоконагруженных околоигровых сервисов
  2. Расскажу про базовые концепции в кафке Расскажу зачем вам апач кемел Причем тут спринг бут Покажу пример Постараюсь ответить на вопросы
  3. JMS брокеры плохо масштабируются Нужны сторонние решения по репликации или шаред хранилище Какфка хорошо масштабируется и имеет встроенный механизм репликации
  4. Uber, Netflix, Cisco, Paypal Несмотря на то что 0.x.x она готова к проду
  5. Имплементированы Хотябы один и Возможно один Есть отправка и получения сообщений пачками для увеличения пропускной способности ЭТО ВАЖНО: Работает на дефолтных настройках
  6. Есть зеркалирование между датацентрами Есть конекторы к DWH базам для BI Есть интеграция с последними решениями в области CEP
  7. Кафка с высоты птичьего полета – стандартный брокер Посредник для асинхронного обмена сообщениями Необходимый компонент для хореографии серсисов
  8. Семантика очереди и топика Отправители сообщений – продюсеры Получатели – консюмеры
  9. Кафка это не JMS сервер Также нет JMS клиента Весь ваш код можно выкинуть и это неплохо
  10. Например нет хидеров – можно использовать ключ или пейлоад Нет транзакций и прочего что описано в JMS спеке
  11. Кафка НЕ импементирует “только один” семантику Я думаю что никто не имплементирует но тут честно признались Вам придется это решать в коде приложения
  12. Дубликаты возникают по разным причинам Два раза нажали на кнопку отправки Были ошибки сети Ваш консумер должен быть готов к обработке дубликатов Используйте кемел и паттерны
  13. Какфка брокер содержит топики Топики содержат партишены Партишен это файл с сообщенийми Топик это папка с файлами
  14. Топик это поток сообщений Партишен это часть сообщений в потоке В кафке нет очередей но семантика очереди возможна
  15. Партишен это файл Продюсер всегда апендит в файл Консюмер сканирует (seek) файл чтобы прочитать сообщения
  16. Офсет консюмера сохраняется на сервере Обычно в зукипере но в новой кафке можно и в брокере Порядок доставки сообщений соответствует порядку отправки (если нет ошибок)
  17. Очередь сделана путем объединения консумеров в группы Каждый партишен обрабатывается только одним консумеров из группы Одно сообщение читается один раз группой вне независимости от количества консумеров
  18. Офсет в партишене хранится по имени группы Внутри группы мы имеем семантику очереди Между группами мы имеем семантику топика
  19. Это значит что одна группа может иметь в разных партишенах разный офсет
  20. Консумеры полят данные с брокера Офсет хранится на сервере Автокомит включен отправка офсета в одтельном потоке Автокомит выключен – отправка вашим кодом по окончанию процессинга
  21. Если вы используете автокомит вы можете потерять сообщения
  22. Автокомит норм для отправки и обработки статус сообщений Автокомит не норм когда обрабатываются важные сообщения например платежи
  23. В репликации данных есть роли брокера Лидер для партиции Фоловер для партиции Контроллер репликации Координатор
  24. Лидер работает с клиентами Фоловер забирает изменения с лидера Контроллер следит за лидером и фоловерами Зукипер помогает выбирать лидера
  25. Продюсер кафки умеет делать балансировку нагрузки
  26. Продюсер выбирает партишен по ключу (хешированием) Находит лидера партиции и отправляет сообщения Ждет или не ждет подтвержения от реплик Умеет отправлять сообщения пачками
  27. Кафка обеспечивает гарантированную доставку сообщений Данные не хранятся в памяти – все хранится на дисках
  28. Для гарантированной доставки важно: Правильно выбрать количество подтвердивших партиций при отправке Правильно сконфигурить репликацию Вручную комитить офсет
  29. Администрирование не бесплатное, в зависимостях зукипер Однако есть варианты установки через локер Для мониторинга и понимания метрик надо понимать как работает кафка
  30. Если вы добавляете ноды в кластер существующие данные сами переезжать не будут Зеркалирование работает в одну сторону У вас не получится создать каждому юзеру по топику
  31. Кафка апи это low-level уровень для работы с брокером Вы начнете изобретать более высокий уровень абстакции Вы сделаете это неправильно
  32. Кемел уже предоставляет декларативную обработку сообщений Он также позволяет использовать имплементацию EIP А также есть абстракции для тестирования
  33. Пример обработки файла кемелом Декларативная обработка сообщений
  34. Я не советую использовать сервисмикс/фьюз/фабрик и прочие псевдо-контейнеры Кемел можно встроить в ваше приложение Также есть автоконфигурация для бута Также есть адаптеры к куче источников данных и сообщений
  35. Спринг бут требует отдельной презентации Для тех кто не знает это фреймворк для построения сервисов возможно микро
  36. В двух словах бут предоставляет утилиты для фатжар серсиов Предоставляет также механизм автоконфигурайций для зависимостей Это позволяет использовать например проекты от нетфликс
  37. А теперь немного кода
  38. Иметь много партишенов авторы не рекомендуют Один партишен процессится одним консумеров в группе Продюсеры могут быть намного быстрее консумаров
  39. Нужно мониторить лаг (непрочитанные сообщения) по группе Можно добавить инмеморию кью в которую перекладывать сообщения и ее процессить бОльшим числом потоком Можно попробовать добавить больше партишенов
  40. Есть тул для мониторинга лага кафки вот его UI
  41. В тестах может быть ситуация что вы отправляете сообщения но не получаете их Проверьте настройку auto.offset.reset, она может быть выставлена в «получать только новые»
  42. Желательно версию клиента иметь такой же как версия сервера или ниже Если вы видите странное – проверьте класспас
  43. Есть замечательный GUI плагин к идее который позволяет резолвить зависимости